MySQL is installed on my laptop and it works fine, except that I am allowed to log in without supplying the root password. I can also log in by supplying the root password. If the supplied password doesn't match, it denies access. The root password was changed to something of my own choosing when I originally installed MySQL. I just noticed the no-password logins today.
So, I need to stop access to the root account when a password isn't supplied. What I've tried so far is to reset the root password with:
mysqladmin -u root password TopSecretPassword
I then logged in to the console and issued:
mysql> flush privileges; exit;
I'm still able to log in to MySQL with:
%> mysql -u {enter}
How do I stop this behavior?
ADDITIONAL DETAILS:
%> mysql -u {enter} mysql>SELECT USER(), CURRENT_USER(); > root@localhost, root@localhost mysql>SELECT COUNT(*) FROM mysql.users WHERE user='root' AND password=''; > COUNT(*) > 0 mysql>SELECT COUNT(*) FROM mysql.users WHERE user=''; > COUNT(*) > 0 mysql>SELECT COUNT(*) FROM mysql.users WHERE user='root'; > COUNT(*) > 1 %> vi /etc/my.cnf /skip-grant-tables > E486: Pattern not found: skip-grant-tables
SELECT user,host,password FROM mysql.user;
and place that display in your answer. Don't worry about the password. It should be MD5 encrypted.<samp>
, you can mark screen samples with<blockquote><pre>
. Edit your question and try it out. Code (when you have it) can be marked by indenting each line with four spaces.