After install MySQL, it’s important that you secure the installation by (a) removing anonymous accounts and (b) setting a password on the admin account. This can be done with mysqladmin or with direct SQL queries. I prefer the SQL queries so that’s what I’ll show here.
- Start mysql command line utility and select the mysql database.
- Remove anonymous accounts.
- Set a password on the mysql root account.
- Flush privileges.
[root@localhost]# <strong>mysql mysql</strong>
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17073
Server version: 5.5.27 Distributed by The IUS Community Project
mysql> <strong>delete from user where user = "";</strong>
Query OK, 2 rows affected (0.00 sec)
mysql> <strong>update user set password = PASSWORD('EXnFIT34aU2hXAH2');</strong>
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> <strong>flush privileges;</strong>
Query OK, 0 rows affected (0.00 sec)