Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist(

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist(相关的知识,希望对你有一定的参考价值。

[[email protected] download]# service mysqld start

Redirecting to /bin/systemctl start  mysqld.service




Job for mysqld.service failed because a timeout was exceeded. See "systemctl status mysqld.service" and "journalctl -xe" for details.


解决了一个安装包的问题,然后安装后mysql起不来啊



 more /etc/my.cnf |grep -v ^#

[[email protected] ~]# more /etc/my.cnf |grep -v ^#


[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock


symbolic-links=0


sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 


[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid


配置看起来都正常


systemctl status -l mysqld 找了错误日志/var/log/mysqld.log


  CGroup: /system.slice/mysqld.service

           ├─5472 /bin/sh /usr/bin/mysqld_safe

           └─5638 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock


Nov 04 17:21:49 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.

Nov 04 17:21:49 localhost.localdomain systemd[1]: Starting MySQL Community Server...

Nov 04 17:21:49 localhost.localdomain mysqld_safe[5472]: 161104 17:21:49 mysqld_safe Logging to ‘/var/log/mysqld.log‘.

Nov 04 17:21:50 localhost.localdomain mysqld_safe[5472]: 161104 17:21:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Nov 04 17:21:50 localhost.localdomain systemd[1]: Started MySQL Community Server.


tail 下日志然后搜索了下这个错误


Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t exist


使用脚本初始化数据库,无效

scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --ldata=/var/lib/mysql



权限不足,然后加了2个目录的权限

chown -R mysql /var/lib/mysql

chgrp -R mysql /var/lib/mysql




终于进来了


[[email protected] ~]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.6.34 MySQL Community Server (GPL)


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


mysql> 


本文出自 “于昊(Pcdog)的博客” 博客,请务必保留此出处http://433266.blog.51cto.com/423266/1869687

以上是关于Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist(的主要内容,如果未能解决你的问题,请参考以下文章

Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist(

Mysql报错Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't

Fatal error: Can't use function return value in write context

Fatal error: Can't use function return value in write context的问题

mysql安转过程中出现的问题! Fatal error: Can't open and lock privilege tables: Table 'mysql.user' d

mysql安转过程中出现的问题! Fatal error: Can't open and lock privilege tables: Table 'mysql.user' d