项目场景:
在linux系统下mysql安装的时候出现了以下问题:
1.mysql-community-icu-data-files = 8.0.30-1.el7 is needed by mysql-community-server-8.0.30-1.el7.x86_64
2.Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
3.sudo service mysqld restart
Starting MySQL.. ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
4.systemctl restart mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
解决方案:
1.输入以下指令:
sudo rpm -ivh mysql-community-icu-data-files-8.0.30-1.el7.x86_64.rpm
2.输入以下指令:
find / -name mysql.sock
如果存在mysql.sock文件
则创建软连接文件:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
如果不存在,则查找其他教程。
3.查看错误日志
tail -40f /var/log/mysqld.log
2022-10-15T14:24:18.779213Z 1 [ERROR] [MY-012526] [InnoDB] Upgrade is not supported after a crash or shutdown with innodb_fast_shutdown = 2. This redo log was created with MySQL **5.7.38**, and it appears logically non empty. Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/upgrading.html
2022-10-15T14:24:18.779259Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2022-10-15T14:24:19.225017Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-10-15T14:24:19.225272Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-10-15T14:24:19.225312Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-15T14:24:19.226495Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30) MySQL Community Server - GPL.
安装mariadb-server服务
yum -y install mariadb-server
查看以前是否装有mysql:
rpm -qa|grep -i mysql
删除以前装的:
rpm -ev perl-DBD-MySQL-4.023-6.el7.x86_64
重新安装mariadb服务:
yum -y install mariadb-server
4.输入以下命令:
journalctl -xe
Oct 15 22:33:15 SUPERQ systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Oct 15 22:33:15 SUPERQ systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Oct 15 22:33:15 SUPERQ systemd[1]: Unit mysqld.service entered failed state.
Oct 15 22:33:15 SUPERQ systemd[1]: mysqld.service failed.
Oct 15 22:33:15 SUPERQ polkitd[535]: Unregistered Authentication Agent for unix-process:9259:43860759 (system bus name :1.2677, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Oct 15 22:33:15 SUPERQ root[9315]: [euid=root]:root pts/6 2022-10-15 15:07 (124.xxx.xxx.149):[/home/superq/test]2022-10-15 22:33:14 root systemctl start mysqld
Oct 15 22:33:31 SUPERQ root[9339]: [euid=root]:root pts/6 2022-10-15 15:07 (124.xxx.xxx.149):[/home/superq/test]2022-10-15 22:33:31 root systemctl status mysqld.service
lines 3563-3602/3602 (END)