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

[root@localhost 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 ^#

[root@localhost ~]# 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




终于进来了


[root@localhost ~]# 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> 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值