MySQL [ERROR] Table 'mysql.user' doesn't exist

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:     一次源码新装的mysql,由于没有复制my-default.cnf到/etc/my.cnf位置,在启动mysql的时候碰到了无法打开mysql.user表的错误。

    一次源码新装的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。下面是该错误的描述及其解决办法。

 

1、现象描述
[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

# Author : Leshami
# Blog   : 
http://blog.csdn.net/leshami

 

2、解决办法
#查看当前的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  ]

 

3、更多参考
Linux 下MySQL源码安装完整版
MySQL 源码scr.rpm安装的一点注意事项
Linux 5 下安装MySQL 5.6(RPM方式)
Linux 下卸载MySQL 5

鹏城DBA总群

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
4月前
|
关系型数据库 MySQL
MySQL 报错 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file
MySQL 报错 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file
306 0
|
3月前
|
关系型数据库 MySQL
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema‘@‘localhost‘) does not exist
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema‘@‘localhost‘) does not exist
21 0
|
3月前
|
SQL 数据采集 关系型数据库
如何解决MySQL报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL?
如何解决MySQL报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL?
|
18天前
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL连接ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password‘ cannot be loaded
MySQL连接ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password‘ cannot be loaded
25 0
|
6月前
|
关系型数据库 MySQL
Mysql报错:InnoDB: Operating system error number 13 in a fil..的解决方法
Mysql报错:InnoDB: Operating system error number 13 in a fil..的解决方法
107 0
|
4月前
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
27 0
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
|
5月前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such
|
5月前
|
SQL 关系型数据库 MySQL
Could not execute query ---> MySql.Data.MySqlClient.MySqlException: You have an error in your SQL sy
Could not execute query ---> MySql.Data.MySqlClient.MySqlException: You have an error in your SQL sy
20 0
|
6月前
|
关系型数据库 MySQL Shell
MySQL报错:Got error 28 from storage engine
MySQL报错:Got error 28 from storage engine
|
6月前
|
缓存 关系型数据库 MySQL
Mysql备份时报错:mysqldump: Got error: 1016: Can't open file: '**.fr..
Mysql备份时报错:mysqldump: Got error: 1016: Can't open file: '**.fr..