MySQL [ERROR] 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。下面是该错误的描述及其解决办法。

1、现象描述
[[email protected] scripts]# service mysqld start
Starting MySQL..The server quit without updating PID file (/var/lib/mysql/HKBO.pid).[FAILED]

#查看错误日志
[[email protected] 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配置文件
[[email protected] 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至正确路径后,问题解决
[[email protected] scripts]# vi /etc/my.cnf
[[email protected] support-files]# more /etc/my.cnf |grep datadir
datadir=/opt/data

[[email protected] support-files]# service mysqld start
Starting MySQL.[  OK  ]

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

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

时间: 2024-10-07 22:00:38

MySQL [ERROR] Table 'mysql.user' doesn't exist的相关文章

InnoDB: Error: Table "mysql"."innodb_table_stats" not found.

1,Mysqldump的时候报错如下: 2014-05-05 14:12:37 7f004a9a2700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found. 但是show tables我看这个表示存在的: 但是show create table innodb_index_stats;报错如下: mysql> show create table innodb_index_stats; ERRO

Mysql innodb错误解决 InnoDB: Error: table `mysql`.`innodb_table_stats`

通过ELK监控发现,程序连接mysql DB 失败,通过看程序的log和mysql的error log发现mysql中出现error 查看Mysql日志 发现 InnoDB: Error: table `mysql`.`innodb_table_stats` does not exist in the InnoDB internal 这个原因很明显 ,是mysql库的innodb_table_stats表损坏了. 首先登录mysql查看表是否存在?   结果:存在的. Tables_in_mys

Error: Table "mysql"."innodb_table_stats" not found.

Error: Table "mysql"."innodb_table_stats" not found. 2013-04-02 09:07:35 7fc53f5e4700 InnoDB: Recalculation of persistent statistics requested for table "mydatabase"."mytable" but the required persistent statistics

MySql Table错误:is marked as crashed and last (automatic?) 和 Error: Table "mysql"."innodb_table_stats" not found

一.mysql 执行select 的时候报Table错误:is marked as crashed and last (automatic?) 解决方法如下: 找到mysql的安装目录的bin/myisamchk工具,在命令行中输入: myisamchk -c -r ../data/dedecmsv4/dede_archives.MYI 然后myisamchk 工具会帮助你恢复数据表的索引.重新启动mysql,问题解决. 问题分析: 1.错误产生原因,有网友说是频繁查询和更新dede_archi

InnoDB: Error: Table "mysql"."innodb_table_stats" not found索引表没找到,主从停止

InnoDB: Error: Table "mysql"."innodb_table_stats" not found. 导致:Seconds_Behind_Master: 27360  mysql主从同步停止 stop slave; 会一直卡住,service mysqld restart后,马上又会停止同步,出现同样问题. 初步判断: 因为innodb_table_stats表丢失,导致主从同步出现问题. 解决办法: 新建innodb_index_stats/i

Mysql的“Table 'mysql.servers' doesn't exist”的解决方法

安装MYSQL后,又一次系统出现问题了,于是我查看mysql的错误日志,竟发现Table 'mysql.servers' doesn't exist问题的错误, 虽然与我的问题无关,但这个问题还是引起我的注意. 分析看是缺少mysql.servers这个表. 后上网寻找解决办法,发现解决这个问题有两个方法: 解决方法一,自己建立这张表. use mysql;CREATE TABLE `servers` (`Server_name` char(64) NOT NULL,`Host` char(64

MySQL 5.6 解决InnoDB: Error: Table "mysql"."innodb_table_stats" not found.问题

在安装MySQL 5.6.30时,安装完成后,后台日志报如下警告信息:2016-05-27 12:25:27 7fabf86f7700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.2016-05-27 12:25:27 7fabf86f7700 InnoDB: Error: Fetch of persistent statistics requested for table "hj

mysql error: (2006, 'MySQL server has gone away')

max_allowed_packet=16M wait_timeout=400000 interactive_timeout = 400000 vim /etc/my.cnf  mysqld 中加入上面的内容. mysql error: (2006, 'MySQL server has gone away')

MySQL Error Codes MYSQL的错误代码

OS error code 1: Operation not permitted OS error code 2: No such file or directory OS error code 3: No such process OS error code 4: Interrupted system call OS error code 5: Input/output error OS error code 6: No such device or address OS error code