![升级后无法启动 MySQL 服务器](https://linux22.com/image/641143/%E5%8D%87%E7%BA%A7%E5%90%8E%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%20MySQL%20%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
升级后无法启动 MySQL 服务器
我刚刚将 MySQL 从 5.1.59 升级到 5.6.20(OSX 10.7),现在 MySQL 服务器无法启动。
在 MySQL Workbench (v6.1.7) 中,在启动/关闭视图中,尝试启动服务器时,启动消息日志内容如下:
Could not open error log file: [Errno 2] The indicated path does not exist
2014-09-06 11:21:52 - Starting server...
2014-09-06 11:21:52 - Executing '/usr/local/mysql/support-files/mysql.server start'
2014-09-06 11:21:52 - Start server: Starting MySQL
2014-09-06 11:21:52 - Start server: .. ERROR! The server quit without updati
2014-09-06 11:21:52 - Start server: ng PID file (/usr/local/mysql/data/new-host-3.home.pid).
2014-09-06 11:21:52 - Server start done.
2014-09-06 11:21:52 - Checking server status...
2014-09-06 11:21:52 - Trying to connect to MySQL...
2014-09-06 11:21:52 - Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (2002)
2014-09-06 11:21:52 - Assuming server is not running
2014-09-06 11:21:52 - Checking server status...
2014-09-06 11:21:52 - Trying to connect to MySQL...
2014-09-06 11:21:52 - Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (2002)
2014-09-06 11:21:52 - Assuming server is not running
而在 /usr/local/mysql-5.6.20-osx10.7-x86_64/data/new-host-3.home.err 中内容如下:
140906 11:43:58 mysqld_safe mysqld from pid file /usr/local/mysql/data/new-host-3.home.pid ended
140906 12:08:40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2014-09-06 12:08:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-09-06 12:08:40 3850 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2014-09-06 12:08:40 3850 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
2014-09-06 12:08:40 3850 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2014-09-06 12:08:40 3850 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-09-06 12:08:40 3850 [Note] InnoDB: The InnoDB memory heap is disabled
2014-09-06 12:08:40 3850 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-09-06 12:08:40 3850 [Note] InnoDB: Memory barrier is not used
2014-09-06 12:08:40 3850 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-09-06 12:08:40 3850 [Note] InnoDB: Using CPU crc32 instructions
2014-09-06 12:08:40 3850 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-09-06 12:08:40 3850 [Note] InnoDB: Completed initialization of buffer pool
2014-09-06 12:08:40 3850 [Note] InnoDB: Highest supported file format is Barracuda.
2014-09-06 12:08:40 3850 [Note] InnoDB: 128 rollback segment(s) are active.
2014-09-06 12:08:40 3850 [Note] InnoDB: Waiting for purge to start
2014-09-06 12:08:40 3850 [Note] InnoDB: 5.6.20 started; log sequence number 1600957
2014-09-06 12:08:40 3850 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1164d342-35e0-11e4-a780-9b19ad1a780d.
2014-09-06 12:08:40 3850 [Note] Server hostname (bind-address): '*'; port: 3306
2014-09-06 12:08:40 3850 [Note] IPv6 is available.
2014-09-06 12:08:40 3850 [Note] - '::' resolves to '::';
2014-09-06 12:08:40 3850 [Note] Server socket created on IP: '::'.
2014-09-06 12:08:40 3850 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
140906 12:08:40 mysqld_safe mysqld from pid file /usr/local/mysql/data/new-host-3.home.pid ended
140906 13:01:13 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2014-09-06 13:01:13 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-09-06 13:01:13 4213 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2014-09-06 13:01:13 4213 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
2014-09-06 13:01:13 4213 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2014-09-06 13:01:13 4213 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-09-06 13:01:13 4213 [Note] InnoDB: The InnoDB memory heap is disabled
2014-09-06 13:01:13 4213 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-09-06 13:01:13 4213 [Note] InnoDB: Memory barrier is not used
2014-09-06 13:01:13 4213 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-09-06 13:01:13 4213 [Note] InnoDB: Using CPU crc32 instructions
2014-09-06 13:01:13 4213 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-09-06 13:01:13 4213 [Note] InnoDB: Completed initialization of buffer pool
2014-09-06 13:01:13 4213 [Note] InnoDB: Highest supported file format is Barracuda.
2014-09-06 13:01:13 4213 [Note] InnoDB: 128 rollback segment(s) are active.
2014-09-06 13:01:13 4213 [Note] InnoDB: Waiting for purge to start
2014-09-06 13:01:13 4213 [Note] InnoDB: 5.6.20 started; log sequence number 1600957
2014-09-06 13:01:13 4213 [Note] Recovering after a crash using mysql-bin
2014-09-06 13:01:13 4213 [Note] Starting crash recovery...
2014-09-06 13:01:13 4213 [Note] Crash recovery finished.
2014-09-06 13:01:13 4213 [Note] Server hostname (bind-address): '*'; port: 3306
2014-09-06 13:01:13 4213 [Note] IPv6 is available.
2014-09-06 13:01:13 4213 [Note] - '::' resolves to '::';
2014-09-06 13:01:13 4213 [Note] Server socket created on IP: '::'.
2014-09-06 13:01:13 4213 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
140906 13:01:14 mysqld_safe mysqld from pid file /usr/local/mysql/data/new-host-3.home.pid ended
顺便说一下,/var/mysql 中有一个 mysql.sock 文件,并且没有运行 mysqld 进程。
我无法运行 mysql_upgrade 或我看到其他有类似症状的用户建议的任何其他操作,因为我无法启动服务器。这超出了我的 MySQL 意识;有人能解释一下发生了什么以及我该如何修复这个烂摊子吗?
任何帮助都将不胜感激,
軟體系
答案1
根据http://dev.mysql.com/doc/refman/5.5/en/mysql-nutshell.html该--skip-locking
功能/选项已被删除。
从 mysql 启动参数中删除该选项。
答案2
又过了一天,我反复在 Google 上搜索错误,并再次发现 mysql 安装对许多条件各异的用户来说都是无尽的地狱 - 其中包括平台、版本和安装方法 - 我决定放弃修复这个问题(我有一个项目要做,已经在 mysql 上浪费了两天时间),而是卸载 5.6,然后看看以前的版本是否可以运行。但在那之前,我认为再次运行安装程序不会有什么坏处,所以我这样做了......现在该死的东西启动了,没有错误。由于环境、错误和其他受害者的建议等差异很大,我不知道是什么导致了这一切。如果有人还在听,我有一个后续问题:由于我的数据都不是关键的(它们只是测试开发的东西),我没有转储它或以其他方式准备在新版本中复活它。但是,如果可以在不破坏新 mysql 安装创建的任何模式的情况下访问它,我想试一试。再次感谢。