Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No: n
rootのパスワードを設定します。
Please set the password for root here.
New password: [設定するパスワードを入力]
Re-enter new password: [設定するパスワードを再入力]
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, an
y other key for No) : y
anonymousユーザーを削除するか。
利用しないのでyを選択しました。
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? (Press y|Y for Yes, any other key for No) : ySuccess.
rootで外部から接続可能とするか。
「y」で接続不可としました。
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? (Press y|Y for Yes, any other key for No) : y
Success.
デフォルトの「test」データベースを削除するか。
「y」で削除を選択しました。
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? (Press y|Y for Yes, any other key f
or No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
テーブルをリロードするか。
「y」でリロードを実行しました。
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success
mysql> SELECT User , authentication_string FROM mysql.user
mysql> UPDATE user SET authentication_string=password('大文字と記号を含むパスワード') WHERE user='root';
mysql> flush privileges;
mysql> \q
# mysql-uroot -p
(3)MySQLに接続して、パスワード変更
●Windows、LINUX共通
コマンドプロンプトをもう1つ起動させ、以下のコマンドでMySQLに接続、
及びパスワード変更コマンドを実行してください。
以下の画面はWindowsの物ですが、Linuxの場合も同じコマンドで変更できます。
なお、下記では新しいパスワードを「pass」で設定しています。
C:\Users\sasuke>mysql -u root mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.86-community-nt MySQL Community Edition (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>update user set password=PASSWORD(‘pass’) where user=’root’ and host=’localhost’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0