I've been trying to solve this problem for the last 3h. I've just set up a MySQL server on my dedicated root server, running Ubuntu 14.04-minimal. I have no problem logging in as root anywhere - it works just fine on the command line, phpMyAdmin or a php-Script.
Because I did not want to use all my scripts as the root user, I created a new one using this command:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON *.*
'myUser'@'localhost' IDENTIFIED BY 'myPassword';
The user got successfully created and I can login with my password from the command line. However, it seems to be impossible to access MySQL with another user than root from something that is not the commandline.
At first I thought it might be the common host problem, where you have to use both %
and localhost
in the mysql.user database in order to access it from outside the console. But this did not work. I even added the two host entries that the root-user also has (hostname
, ::1
), but I always get the typical Error #1045 - Cannot Log in to MySQL server
. What I've also tried is to directly connect in my scripts (or phpMyAdmin) to either the server's IP-Address or 127.0.01 instead of localhost - without success.
So here is the current status:
- Login as
root
from the console: Works. - Login as
root
from anything else: Works. - Login as
myUser
from the console: Works. - Login as
myUser
from anything else: Doesn't work.
Does anyone have an idea what might cause this issue?