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

发布时间:2020-08-08 08:58:04 作者:宋祖强
来源:ITPUB博客 阅读:617
[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! 
推荐阅读:
  1. CANopen协议介绍
  2. SylixOS SylixOS CAN总线驱动之三

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

can table

上一篇:老司机也必须掌握的MySQL优化指南

下一篇:如何通过动态参数实现周报制作

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》