我使用 yum 升级了 CentOS 服务器上的 MySQL
# mysql --version
mysql Ver 14.14 Distrib 5.1.52, for redhat-linux-gnu (x86_64) using readline 5.1
我运行service mysqld start
并在错误日志中收到以下错误(它告诉我 MySQL 无法启动):
110405 10:10:51 mysqld_safe Starting mysqld daemon with databases from /mnt/persistent/mysql
/usr/libexec/mysqld: Table 'mysql.plugin' doesn't exist
110405 10:10:51 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110405 10:10:51 InnoDB: Started; log sequence number 30 391318478
110405 10:10:51 [ERROR] /usr/libexec/mysqld: unknown variable 'innodb_log_arch_dir=/mnt/persistent/mysql/'
110405 10:10:51 [ERROR] Aborting
110405 10:10:51 InnoDB: Starting shutdown...
110405 10:10:56 InnoDB: Shutdown completed; log sequence number 30 391318478
110405 10:10:57 [Note] /usr/libexec/mysqld: Shutdown complete
110405 10:10:57 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
因此,我mysql_upgrade
按照第 3 行的操作运行。但是,出现了错误:
# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock' mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed
我觉得这是一个循环:不mysqld
跑步就无法开始mysql_upgrade
,不跑步就无法mysql_upgrade
跑步mysqld
。
有任何想法吗?
答案1
自 4.0.6 版本以来,变量 innodb_log_arch_dir 已不再使用
如果你注释掉
#innodb_log_arch_dir=/mnt/persistent/mysql/
在你的 my.cnf 中
mysqld 应该可以成功启动。