mysql错误:[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解决方法
本文为大家讲解的是mysql错误:[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解决方法,感兴趣的同学参考下。 错误描述: 一次源码新装的mysql,由于没有复制my- default.cnf到/etc/my.cnf位置,在启动mysql的时候碰到了无法打开mysql.user表的错误
本文为大家讲解的是mysql错误:[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解决方法,感兴趣的同学参考下。
错误描述:
一次源码新装的mysql,由于没有复制my- default.cnf到/etc/my.cnf位置,在启动mysql的时候碰到了无法打开mysql.user表的错误。具体错误为:[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist。
[root@HKBO scripts]# service mysqld start
Starting MySQL..The server quit without updating PID file (/var/lib/mysql/HKBO.pid).[FAILED]
#查看错误日志
[root@HKBO scripts]# tail /var/log/mysqld.log
InnoDB: Apply batch completed
2014-12-08 11:01:37 15721 [Note] InnoDB: 128 rollback segment(s) are active.
2014-12-08 11:01:37 15721 [Note] InnoDB: Waiting for purge to start
2014-12-08 11:01:37 15721 [Note] InnoDB: 5.6.12 started; log sequence number 1600607
2014-12-08 11:01:37 15721 [Note] Server hostname (bind-address): '*'; port: 3306
2014-12-08 11:01:37 15721 [Note] IPv6 is available.
2014-12-08 11:01:37 15721 [Note] - '::' resolves to '::';
2014-12-08 11:01:37 15721 [Note] Server socket created on IP: '::'.
2014-12-08 11:01:37 15721 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
141208 11:01:37 mysqld_safe mysqld from pid file /var/lib/mysql/HKBO.pid ended
解决办法:
#查看当前的my.cnf配置文件
[root@HKBO scripts]# more /etc/my.cnf |grep -v ^#
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
old_passwords=1[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
#由于编译安装时指定的路径为/opt/data以及mysql_install_db时指定的datadir也为/opt/data,而my.cnf为缺省的路径
#因此修改datadir至正确路径后,问题解决
[root@HKBO scripts]# vi /etc/my.cnf
[root@HKBO support-files]# more /etc/my.cnf |grep datadir
datadir=/opt/data
[root@HKBO support-files]# service mysqld start
Starting MySQL.[ OK ]
标签: mysql 错误 ERROR Fatal error Can open and lock
声明:本文内容来源自网络,文字、图片等素材版权属于原作者,平台转载素材出于传递更多信息,文章内容仅供参考与学习,切勿作为商业目的使用。如果侵害了您的合法权益,请您及时与我们联系,我们会在第一时间进行处理!我们尊重版权,也致力于保护版权,站搜网感谢您的分享!