Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

[root@ szq scripts]# service mysqld start
Starting MySQL.. The server quit without updating PID file (/var/lib/mysql/szq.pid).[FAILED]

# more   /prosync/mysql/mysql/data/szq.err 
查看报错:
160413 04:46:40 mysqld_safe Starting mysqld daemon with databases from /prosync/mysql/mysql/data
2016-04-13 04:46:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-13 04:46:40 0 [Note] /prosync/mysql/mysql/bin/mysqld (mysqld 5.6.30) starting as process 29379 ...
2016-04-13 04:46:40 29379 [Note] Plugin 'FEDERATED' is disabled.
/prosync/mysql/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
2016-04-13 04:46:40 29379 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-04-13 04:46:40 29379 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-04-13 04:46:40 29379 [Note] InnoDB: The InnoDB memory heap is disabled
......
2016-04-13 04:46:41 29379 [Note]   - '::' resolves to '::';
2016-04-13 04:46:41 29379 [Note] Server socket created on IP: '::'.
2016-04-13 04:46:41 29379 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
160413 04:46:41 mysqld_safe mysqld from pid file /prosync/mysql/mysql/data/szq.pid ended
160413 04:49:43 mysqld_safe Starting mysqld daemon with databases from /prosync/mysql/mysql/data
......
/prosync/mysql/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
2016-04-13 04:49:43 29528 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-04-13 04:49:43 29528 [Note] InnoDB: Using atomics to ref count buffer pool pages
......
2016-04-13 04:49:43 29528 [Note] Server socket created on IP: '::'.
2016-04-13 04:49:43 29528 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
160413 04:49:43 mysqld_safe mysqld from pid file /prosync/mysql/mysql/data/szq.pid ended

解决办法:
#查看当前的my.cnf配置文件
[root@ szq scripts]# more /etc/my.cnf |grep -v ^#

[mysqld]
basedir =/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

#由于编译安装时指定的路径为/prosync/mysql/mysql/, mysql_install_db时指定的datadir为/prosync/mysql/mysql/data,而my.cnf为缺省的路径
#因此修改datadir至正确路径后,问题解决
[root@ szq scripts]# vi /etc/my.cnf
[root@ szq support-files]# more /etc/my.cnf |grep datadir
basedir = /prosync/mysql/mysql
datadir = /prosync/mysql/data

[root@szq kdb11]# service mysql start 
Warning: World-writable config file '/prosync/mysql/mysql/my.cnf' is ignored
Starting MySQL. SUCCESS! 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29289867/viewspace-2080843/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29289867/viewspace-2080843/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值