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文件夹即可

你可能感兴趣的:(mysql,安装)