MySQL安裝故障解決

來源:互聯網
上載者:User

MySQL安裝故障解決

mysql故障:

[root@MYSQL_M ~]# /etc/init.d/mysqld restart

Starting MySQL....... ERROR! Manager of pid-file quit without updating file.

[root@MYSQL_M ~]#

可能一:

啟動設定檔/etc/init.d/mysqld 中的basedir和datadir目錄沒有指定,預設找安裝目錄去了。需要就需要指定datadir的目錄。

上面兩個目錄應該為初始化資料庫時候指定的基礎目錄和資料目錄。例如我的初始化目錄為下面的命令。

/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/data --user=mysql

所以我修改為:

vim /etc/init.d/mysqld

 46 basedir=/application/mysql

 47 datadir=/data

可能二

mysqld的資料目錄屬主不是MYSQL,或者uid不對。也就是上面中的data目錄的屬主不對。修改為相同的屬主即可。

chown -R mysql.mysql /data

可能三

是mysql下的tmp目錄許可權問題。導致無法建立socket.

日誌中報下面的錯誤:

151105 13:42:49  InnoDB: Started; log sequence number 0 44233

151105 13:42:49 [ERROR] Can't start server : Bind on unix socket: Permission denied

151105 13:42:49 [ERROR] Do you already have another mysqld server running on socket: /application/mysql5.1.72/tmp/mysql.sock ?

151105 13:42:49 [ERROR] Aborting

查看/application/mysql/tmp許可權問題

[root@MYSQL_S ~]# ll /application/mysql/

total 32

drwxr-xr-x  2 root  root 4096 Nov  5 09:32 bin

drwxr-xr-x  3 root  root 4096 Nov  4 23:55 include

drwxr-xr-x  3 root  root 4096 Nov  4 23:55 lib

drwxr-xr-x  2 root  root 4096 Nov  4 23:55 libexec

drwxr-xr-x 10 root  root 4096 Nov  4 23:55 mysql-test

drwxr-xr-x  6 root  root 4096 Nov  4 23:55 share

drwxr-xr-x  5 root  root 4096 Nov  4 23:55 sql-bench

drwxr-xr-x  2 root root 4096 Nov  5 13:25 tmp

[root@MYSQL_S ~]#

發現/application/mysql/tmp這個目錄的屬主是root了。但是這個目錄的屬主本應該是mysql,也就是你用下面命令初始化資料庫時指定的使用者名稱

/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/data --user=mysql

所以授權為mysql即可

[root@MYSQL_S ~]# chown mysql /application/mysql/tmp/

[root@MYSQL_S ~]# /etc/init.d/mysqld start         

Starting MySQL. SUCCESS!

[root@MYSQL_S ~]#

本文永久更新連結地址:

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.