发布于 2014-12-08 16:19:37 | 22965 次阅读 | 评论: 1 | 来源: PHPERZ

这里有新鲜出炉的Mysql教程,程序狗速度看过来!

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型胜博发888手机平台中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型胜博发888手机平台为了降低胜博发888手机平台总体拥有成本而选择了MySQL作为胜博发888手机平台数据库。


本文为大家讲解的是mysql错误:[ERROR] Fatal error: Can't open and lock privilege tables: 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。


[[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

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



相关阅读 :
mysql错误:[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist解决方法
mysql错误: Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist原因及解决方法
php 不能连接数据库 php error Can't connect to local MySQL server
MySQL错误 ERROR 2006 (HY000): MySQL server has gone away解决方法
mysql报错 ERROR 2006 (HY000) at line xx: MySQL server has gone away 解决方法
php运行提示Can't connect to MySQL server on 'localhost'的解决方法
Can't connect to MySQL server on localhost (10061)解决方法
PHP错误:Deprecated: mysql_connect(): The mysql extension is deprecated的解决方法
php mysql错误:MySQL server has gone away解决方法
MySQL Sleep连接过多问题解决方法
MySQL远程连接丢失问题解决方法(Lost connection to MySQL server)
cmd中MySQL中文数据乱码问题解决方法
最新网友评论  共有(1)条评论 发布评论 返回顶部
vceq 发布于2016-05-02 14:21:29
大赞.
支持(0)  反对(0)  回复
月排行榜

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  服务