安装MySQL5.7遇到的一些问题
1.MySQL没加入开机自启动,每次启动虚拟机的时候MySQL没有启动,手动启动:systemctl start mysqld.service
然后就报错:
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
查看日志如下:
[root@laiye log]# tail -f /var/log/mysqld.log
2020-05-17T05:47:33.804574Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.30' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
2020-05-17T05:50:07.976326Z 2 [Note] Access denied for user 'root'@'localhost' (using password: YES)
2020-05-17T05:51:02.259336Z 3 [Note] Access denied for user 'root'@'localhost' (using password: YES)
2020-05-17T05:51:58.024437Z 4 [Note] Access denied for user 'root'@'localhost' (using password: YES)
2020-05-17T05:55:57.869202Z 5 [Warning] Plugin validate_password reported: 'Effective value of validate_password_length is changed. New value is 4'
2020-05-17T06:23:02.637971Z 7 [Warning] IP address '192.168.171.1' could not be resolved: Name or service not known
2020-05-17T06:23:02.640461Z 7 [Note] Access denied for user 'root'@'192.168.171.1' (using password: YES)
2020-05-17T14:45:05.966082Z 9 [Note] Aborted connection 9 to db: 'unconnected' user: 'uibot' host: '192.168.171.1' (Got timeout reading communication packets)
2020-05-17T14:45:05.966631Z 8 [Note] Aborted connection 8 to db: 'uibot_commander' user: 'uibot' host: '192.168.171.1' (Got timeout reading communication packets)
查看MySQL服务状态:
[root@laiye log]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since 一 2020-05-11 10:41:05 CST; 6min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 2370 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 2343 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
5月 11 10:41:05 laiye systemd[1]: Failed to start MySQL Server.
5月 11 10:41:05 laiye systemd[1]: Unit mysqld.service entered failed state.
5月 11 10:41:05 laiye systemd[1]: mysqld.service failed.
5月 11 10:41:05 laiye systemd[1]: mysqld.service holdoff time over, scheduling restart.
5月 11 10:41:05 laiye systemd[1]: Stopped MySQL Server.
5月 11 10:41:05 laiye systemd[1]: start request repeated too quickly for mysqld.service
5月 11 10:41:05 laiye systemd[1]: Failed to start MySQL Server.
5月 11 10:41:05 laiye systemd[1]: Unit mysqld.service entered failed state.
5月 11 10:41:05 laiye systemd[1]: mysqld.service failed.
反正没看出什么也有用的信息,继续百度找答案···
搞毛线, 太多了,直接重装一下算了
1,先卸载
yum remove mysql
2,查看yum是否安装过mysql
yum list installed mysql*
yum remove 对应的包
rm -rf /var/lib/mysql
rm /etc/my.cnf
3,rpm查看安装
rpm -qa | grep -i mysql
rpm -e 对应找到的包
cd /var/lib/
rm -rf mysql/
4,清除余项
whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql /usr/local/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
删除上面的文件夹
rm -rf /usr/bin/mysql
5,删除配置
rm –rf /usr/my.cnf
rm -rf /root/.mysql_sercret
6,剩余配置检查
chkconfig --list | grep -i mysql
chkconfig --del mysqld