解決方案有如下5種,我一般使用第一種就解決問題了,其他的在網上搜索的整理如下可做參考
1、kill已存在的mysql進程
ps -ef | grep mysqld kill -9 xxx
2、mysql文件權限不足
chown -R mysql:mysql /mnt/mysql chmod -R 755 /mnt/mysql /etc/init.d/mysqld restart
3、第二次安裝mysql,之前有殘余數據影響服務啟動
刪除/mysql_data目錄下的mysql-bin.index文件
4、查看配置文件my.cnf
[root@tzPC mysql]# cat /etc/my.cnf [mysqld] user=mysql basedir=/mnt/mysql datadir=/mnt/mysql_data #查看是否有此行 socket=/tmp/mysql.sock server_id=6 port=3306 [mysql] socket=/tmp/mysql.sock
5、關閉selinux
[root@tzPC mysql]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
