實例講解啓動mysql server失敗的解決方法

  啓動mysql server 失敗,查看/var/log/mysqld.err
  080329 16:01:29 [ERROR] Can't start server : Bind on unix socket: No such file or directory
  080329 16:01:29 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
  080329 16:01:29 [ERROR] Aborting
  080329 16:01:29 InnoDB: Starting shutdown...
  080329 16:01:30 InnoDB: Shutdown completed; log sequence number 0 4646872
  080329 16:01:30 [Note] /usr/sbin/mysqld: Shutdown complete
  百思不得其解,後來查看/var/db/pkg/dev-db/mysql-5.0.56/CONTENTS 文件,或者執行equery f mysql(兩種方法非Gentoo Linux 發布不適用),得知安裝文件中包含/var/run/mysqld,而這個目錄不存在,回憶起之前曾清空過/var/run目錄,一直以爲這下面的內容都是動態創建,刪除之後重啓系統即可,看來對mysql 來說還不是這麽回事。
  創建此目錄,並chown,問題解決。
  # mkdir /var/run/mysqld
  # chown mysql:mysql /var/run/mysqld