mysql_secure_installation

最終更新日時:2012-08-16 00:00:00
MySQL

概要


mysql_secure_installation を実行することにより、MySQL の初期データの設定、主にセキュリティ回りの設定を行うことが出来ます。
インストール直後に実行すると、非常に便利です。

実行


単にコマンドを実行すれば、後はインタラクティブに設定が行えます。

 # mysql_secure_installation
 
 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
 
 In order to log into MySQL to secure it, we'll need the current
 password for the root user.  If you've just installed MySQL, and
 you haven't set the root password yet, the password will be blank,
 so you should just press enter here.


まず、MySQL 上の root パスワードを聞かれるので入力します。

 Enter current password for root (enter for none): 
 OK, successfully used password, moving on...


MySQL 上の root パスワードを設定できます。
インストール直後であれば、設定しましょう。

 Setting the root password ensures that nobody can log into the MySQL
 root user without the proper authorisation.
 
 Set root password? [Y/n]
 New password:            ← 新しいパスワードを入力
 Re-enter new password:   ← 新しいパスワードを入力(確認)
 Password updated successfully!
 Reloading privilege tables..
  ... Success!


次に、anonymous ユーザーを削除することができます。
通常、anonymous ユーザーは不要だと思われますので、削除することをおすすめします。

 By default, a MySQL installation has an anonymous user, allowing anyone
 to log into MySQL without having to have a user account created for
 them.  This is intended only for testing, and to make the installation
 go a bit smoother.  You should remove them before moving into a
 production environment.
 
 Remove anonymous users? [Y/n]
  ... Success!


次に、他サーバからの root ログインを禁止することができます。
通常、他サーバから root でログインすることは不要だと思われますので、禁止することをおすすめます。

 Normally, root should only be allowed to connect from 'localhost'.  This
 ensures that someone cannot guess at the root password from the network.
 
 Disallow root login remotely? [Y/n]
  ... Success!


次に、test データベースを削除することが出来ます。
test データベースを使う予定がなければ、削除した方がよいでしょう。

 By default, MySQL comes with a database named 'test' that anyone can
 access.  This is also intended only for testing, and should be removed
 before moving into a production environment.
 
 Remove test database and access to it? [Y/n]
  - Dropping test database...
  ... Success!
  - Removing privileges on test database...
  ... Success!


最後に、これらの設定を有効にするために再読み込みを行います。

 Reloading the privilege tables will ensure that all changes made so far
 will take effect immediately.
 
 Reload privilege tables now? [Y/n]  ← 空ENTER
  ... Success!
 
 Cleaning up...


これで、基本的な設定は全て終了です。

 All done!  If you've completed all of the above steps, your MySQL
 installation should now be secure.
 
 Thanks for using MySQL!


お問い合わせは 掲示板 にて。