Published:
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.
Step 8: Delete Empty Localhost Users
MySQL creates a set of blank user accounts for localhost. These are not needed and can be a security issue so lets delete them.
First we select the mysql database. We then get a list of all empty localhost users (just to confirm for later). Next we delete the empty user(s), note you will also have an empty user for your machines hostname, so we delete that also. Finally we rerun of select statement to confirm we have deleted them.
mysql> USE mysql;
mysql> SELECT user, host FROM user;
mysql> DELETE FROM user WHERE host='localhost' AND user='';
mysql> DELETE FROM user WHERE host='[hostname]' AND user='';
mysql> SELECT user, host FROM user;
Thats it you can now logout and restart the server to confirm that mysql now starts correctly with the rest of the server.
Reader Comments