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

來源:互聯網
上載者:User

標籤:mysql

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.