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! 

相关文章

优化MySQL数据库发布系统存储的方法有:1.mysql库主从读写分...
使用mysql的方法:在“我的电脑”→右键→“管理”→“服务”...
在mysql中查看root用户权限的方法:1.命令行启动mysql服务;...
MySQL主从复制是用来备份一个与主数据库一样环境的从数据库,...
运行mysql的方法1.启动mysql服务,在“我的电脑”→右键→“...
开启mysql的方法1.可以通过快捷键win+r,输入cmd,打开窗口,...