Centos7安裝MySQL常見問題

CentOS7下安裝MySQL數據庫常見問題

1. ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
1. 檢查MySql服務是否啓動service mysql start
2. 檢查MySQL-server是否安裝成功,可以通過yum install MySQL-server-5.6.25-1.el7.x86_64.rpm重新安裝

2. Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist
執行mysql_install_db --user=mysql

3. rpm安裝mysql後/etc/目錄下找不到my.cnf
1. whereis mysql查看mysql安裝目錄
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
2. cp /usr/share/mysql/my-default.cnf /etc/my.cnf

4. Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/hsf.pid).
1. 執行yum install -y perl-Module-Install.noarch
2. 執行mysql_install_db --user=mysql
3. 執行service mysql start就可以正常啓動mysql了
4. use mysql
5. update user set password=password('root') where user='root';

5. ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
1. #/etc/init.d/mysql stop
2. #mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3. # mysql -u root mysql
4. mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
5. #/etc/init.d/mysql restart

6. mysql在Linux表明大小寫敏感問題
1. 編輯/etc/my.cnf在[mysqld]下插入lower_case_table_names=1
2. 修改完成後重啓mysql服務
3. 通過show variables like '%case%',查看是否修改成功

7. MySQL不能遠程連接Host is not allowed to connect to Host ‘10.72.35.8’ is not allowd to connect to this MySQL server
GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’WITH GRANT OPTION;
FLUSH PRIVILEGES;

8. Caused by: java.sql.SQLException: Your password has expired. To log in you must change it using a client that supports expired passwords.
mysql5.6.25添加了密碼過期機制
1. use mysql;
2. select host, user, password_expired from user;
3. update user set password_expired='N';

9. ERROR 1728 (HY000): Cannot load from mysql.proc. The table is probably corrupted
執行/etc/bin/mysql_upgrade,若出現無權訪問需要再後面加上用戶名和密碼/etc/bin/mysql_upgrade -u root -p

10. ERROR 1010 (HY000): Error dropping database(can’t rmdir ‘./demo/’,errno:17)
執行find / -name demo
查找到mysql數據表存儲位置,一般爲 /var/lib/mysql/,直接刪除該目錄下的demo文件夾即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章