mysqlの初期設定

MySQL の初期設定
先ずは mysql 管理者のパスワード及び公開設定を行なう.

$ mysql_secure_installation

初回は mysql 管理者のパスワードを聞かれるが, まだ設定していないので何も入力せずにデータベースにアクセスできます. 以下にその後の質問一覧と回答を並べておきます.

Set root password? [Y/n] (Enter)
New password: (適切に入力してください.)
Re-enter password: (適切に入力してください.)
Remove anonymous users? [Y/n] (Enter)
Disallow root login remotely? [Y/n] (Enter)
Remove test database and access to it? [Y/n] (Enter)
Reload privilege tables now? [Y/n] (Enter)

以上の設定を行なった後では匿名ユーザが存在せず, debian-sys-maint と root の二つのユーザが存在するはずである.

mysql> select host,user,password from mysql.user;

                                                                                                                                                      • +
host user password
                                                                                                                                                      • +
localhost root *password の hash が表示されます *
localhost debian-sys-maint *password の hash が表示されます *
                                                                                                                                                      • +

参考サイト

http://www.gfd-dennou.org/arch/davis/gfdnavi/doc/install/install-mysql.htm