Mac El Capitan(10.11.6)。我通过自制程序安装了MySQL(brew install mysql
,安装了5.7.17
)并且能够以默认值启动它(绝对零配置到my.cnf
)。我能够创建一个包含表格的数据库,填充它们等等。
我打开~/.my.cnf
并看到它是空的,这是有道理的,因为我从来没有添加过任何特殊的配置。
所以我添加(到这个空文件):
[mysqld]
default-storage-engine = innodb
default-character-set=utf8
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
然后我运行mysql.server start
启动MySQL并且:
mysql.server start
Starting MySQL
... ERROR! The server quit without updating PID file (/usr/local/var/mysql/MyUsername.local.pid).
如果我清除(并再次清空)~/.my.cnf
的内容并重新启动MySQL,它会很好地启动(没有错误;我可以查询表等)。但如果我重新添加这些内容,我会得到同样的错误。
所以显然 MySQL正在检查~/.my.cnf
是否要加载配置,而明确地那里有关于它不喜欢的语法的东西。所以我开始一系列配置/测试周期,看看哪个属性是罪犯。
我将~/.my.cnf
更改为:
[mysqld]
default-storage-engine = innodb
然后重启。同样的错误。
我将~/.my.cnf
更改为:
[mysqld]
default-character-set=utf8
然后重启。同样的错误。
我将~/.my.cnf
更改为:
[mysqld]
collation-server = utf8_unicode_ci
然后重启。同样的错误。
我将~/.my.cnf
更改为:
[mysqld]
init-connect='SET NAMES utf8'
然后重启。同样的确切错误。显然,其他事情正在发生。当我在~/.my.cnf
中指定任何配置时,MySQL并不喜欢它。 这里发生了什么?!
我尝试了this article中的所有建议,但都没有奏效。绝对看起来像MacOS / MySQL问题。
如果我打开/usr/local/var/mysql/MyUser.local.err
,我会看到:
2017-04-13T13:10:42.6NZ mysqld_safe Logging to '/usr/local/var/mysql/MyUser.local.err'.
2017-04-13T13:10:42.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2017-04-13T13:10:42.365982Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-13T13:10:42.366238Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2017-04-13T13:10:42.366286Z 0 [Note] /usr/local/Cellar/mysql/5.7.17/bin/mysqld (mysqld 5.7.17) starting as process 56561 ...
2017-04-13T13:10:42.369426Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2017-04-13T13:10:42.371041Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-04-13T13:10:42.371058Z 0 [Note] InnoDB: Uses event mutexes
2017-04-13T13:10:42.371062Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-04-13T13:10:42.371066Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-04-13T13:10:42.371389Z 0 [Note] InnoDB: Number of pools: 1
2017-04-13T13:10:42.371487Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-04-13T13:10:42.373341Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2017-04-13T13:10:42.385062Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-04-13T13:10:42.402413Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2017-04-13T13:10:42.456473Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-04-13T13:10:42.456722Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-04-13T13:10:42.498060Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-04-13T13:10:42.499778Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-04-13T13:10:42.499807Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-04-13T13:10:42.500089Z 0 [Note] InnoDB: Waiting for purge to start
2017-04-13T13:10:42.550861Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 6305962580
2017-04-13T13:10:42.551099Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool
2017-04-13T13:10:42.551345Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-04-13T13:10:42.555196Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170413 13:10:42
2017-04-13T13:10:42.559085Z 0 [ERROR] unknown variable 'default-character-set=utf8'
2017-04-13T13:10:42.559125Z 0 [ERROR] Aborting
2017-04-13T13:10:42.559139Z 0 [Note] Binlog end
2017-04-13T13:10:42.559221Z 0 [Note] Shutting down plugin 'ngram'
2017-04-13T13:10:42.559253Z 0 [Note] Shutting down plugin 'partition'
2017-04-13T13:10:42.559266Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2017-04-13T13:10:42.559300Z 0 [Note] Shutting down plugin 'ARCHIVE'
2017-04-13T13:10:42.559311Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2017-04-13T13:10:42.559387Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2017-04-13T13:10:42.559406Z 0 [Note] Shutting down plugin 'MyISAM'
2017-04-13T13:10:42.559430Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2017-04-13T13:10:42.559439Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2017-04-13T13:10:42.559443Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2017-04-13T13:10:42.559447Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2017-04-13T13:10:42.559450Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2017-04-13T13:10:42.559453Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2017-04-13T13:10:42.559457Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2017-04-13T13:10:42.559460Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2017-04-13T13:10:42.559464Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2017-04-13T13:10:42.559467Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2017-04-13T13:10:42.559473Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2017-04-13T13:10:42.559477Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2017-04-13T13:10:42.559510Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2017-04-13T13:10:42.559514Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2017-04-13T13:10:42.559517Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2017-04-13T13:10:42.559523Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2017-04-13T13:10:42.559529Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2017-04-13T13:10:42.559535Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2017-04-13T13:10:42.559539Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2017-04-13T13:10:42.559543Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2017-04-13T13:10:42.559546Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2017-04-13T13:10:42.559550Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2017-04-13T13:10:42.559588Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2017-04-13T13:10:42.559608Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2017-04-13T13:10:42.559622Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2017-04-13T13:10:42.559629Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2017-04-13T13:10:42.559635Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2017-04-13T13:10:42.559640Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2017-04-13T13:10:42.559665Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2017-04-13T13:10:42.559674Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2017-04-13T13:10:42.559681Z 0 [Note] Shutting down plugin 'InnoDB'
2017-04-13T13:10:42.559742Z 0 [Note] InnoDB: FTS optimize thread exiting.
2017-04-13T13:10:42.559798Z 0 [Note] InnoDB: Starting shutdown...
2017-04-13T13:10:42.665019Z 0 [Note] InnoDB: Dumping buffer pool(s) to /usr/local/var/mysql/ib_buffer_pool
2017-04-13T13:10:42.665949Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 170413 13:10:42
2017-04-13T13:10:44.125226Z 0 [Note] InnoDB: Shutdown completed; log sequence number 6305962599
2017-04-13T13:10:44.126507Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-04-13T13:10:44.126528Z 0 [Note] Shutting down plugin 'MEMORY'
2017-04-13T13:10:44.126540Z 0 [Note] Shutting down plugin 'CSV'
2017-04-13T13:10:44.126545Z 0 [Note] Shutting down plugin 'sha256_password'
2017-04-13T13:10:44.126549Z 0 [Note] Shutting down plugin 'mysql_native_password'
2017-04-13T13:10:44.126701Z 0 [Note] Shutting down plugin 'binlog'
2017-04-13T13:10:44.126824Z 0 [Note] /usr/local/Cellar/mysql/5.7.17/bin/mysqld: Shutdown complete
2017-04-13T13:10:44.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/MyUser.local.pid ended