MySQLの初期起動時にエラーを返された・・・。

電脳備忘録
先日CentOS5.4のインストールに成功した「PRIMERGY RX200」に必要なパッケージをインストールして設定しているのですが、MySQLをインストール→設定→初期起動時にエラーを返されてしまいました。

問題は2点あって1つは自分の記述ミス。もう一点は原因は初期起動時に データを初期化→システム テーブルの作成に失敗するため起動に失敗するというものでした。原因はわからないのですが、手動で対応したらうまく行ったのでよしとすることにします。

以下自分用備忘録。
MySQLをインストール後、MySQL設定ファイルから文字コードを編集

# vi /etc/my.cnf

設定ファイルに下記の記述を追加して文字コードを指定して保存。

default-character-set = utf8

[mysql]
default-character-set = utf8


MySQLを起動させたとき、下記のエラーメッセージが表示される。


# /etc/rc.d/init.d/mysqld start

Timeout error occurred trying to start MySQL Daemon.
MySQL を起動中:                          [失敗]


原因を探るため下記コマンドでmysqlのログファイルの内容を確認。

# tail /var/log/mysqld.log


すると下記のようなメッセージが・・・。
/usr/libexec/mysqld: Character set 'utf8 ' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file


どうやらdefault-character-set = utf8 の後ろに不要な文字があるっぽい。確認してみると全角の空白が・・・。
削除して対応。再起動・・・するも起動に失敗。

Timeout error occurred trying to start MySQL Daemon.
MySQL を起動中:                          [失敗]

再度ログファイルの内容を確認。
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

下記のコマンドを実行してシステム テーブルを作成してみる。
# mysql_install_db


Installing MySQL system tables...
091225 20:43:37 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
091225 20:43:37 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
091225 20:43:37 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
091225 20:43:37 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h test-www.alpico.co.jp password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com

MySQL データを初期化→システム テーブルの作成に成功したっぽい。


下記コマンドで再度MySQLを起動したところ無事MySQLが起動しましたとさ。爽快爽快・・・。
# /etc/rc.d/init.d/mysqld start

MySQL を起動中:                        [  OK  ]

広告

ブログの維持費に充てるでございます・・・。