Help us understand the problem. What is going on with this article?

MySQLサーバが起動しない問題

More than 3 years have passed since last update.

環境

  • CentOS 7.0
  • mysql 14.14

内容

MySQLサーバを起動しようとするとFAILEDになる・・・
mysql_error2.png

対処

まず以下のコマンドでlogを確認すると,

 less /var/log/mysqld.log

mysql_error1.png
となり,

unknown variable 'default-character-server=utf8'

であるので,/etc/my.cnfにあるdefault-character-server=utf-8をコメントアウトします.そうすると,Errorは消えました.
しかし,MySQLサーバは起動しませんでした.もう一度/var/log/mysqld.logを見てみると,Can't create/write to file '/var/run/mysqld/mysqld.pid'と出ており,ファイル作成や書き込みが出来ないとのことなので/var/run/mysqldをchownでmysqlユーザにします.
mysql_error3.png

ls -la /var/run/mysqld
ls: cannot access /var/run/mysqld: No such file or directory

まずそんなフォルダなかった・・・のでmkdirでフォルダ作成

mkdir /var/run/mysqld
chown -R mysql:mysql /var/run/mysqld

そして,MySQLサーバ起動すると動いた!
mysql_error4.png

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away