I have an install script that sets up a MySQL user + database + some tables. It worked fine in mysql 5.0, but we recently upgraded to Ubuntu 12.04, which ships with mysql 5.5. However in mysql 5.5 I am getting errors.
The problem seems to be related to adding users. I use a line like this to create a root user, which is later used to login with and set up the rest of the stuff:
INSERT INTO mysql.user VALUES('%','myrootuser','','Y','Y','Y','Y','Y','Y','Y',
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',
'Y','Y','','','','',0,0,0,0,'','');
flush privileges;
The command succeeds. However, when logging in with this new ‘myrootuser’, the user doesn’t seem to have sufficient privileges:
jeroen@jeroen-ubuntu:~$ mysql -u myrootuser -e 'select * from mysql.user;'
ERROR 1142 (42000) at line 1: SELECT command denied to user ''@'localhost' for table 'user'
Also I noticed that I can login with non existing usernames, which might be obfuscating the real problem:
ubuntu@myserver:~$ mysql -u thisuserdoesnotexist
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40
Server version: 5.5.22-0ubuntu1 (Ubuntu)
mysql>
Has there been some change in the MySQL authentication in 5.5 that I am not aware of?
For the user creation problem, try using phpMyAdmin to add it. PMA is better than SQL query!
For your login problem, delete the user
*in the user list (use PMA). It will fix your problem! I got the same problem and I did that to fix it.