Enable remote MySQL connection: ERROR 1045 (28000): Access denied for user

mysql

Solution

Paulo's help lead me to the solution. It was a combination of the following:

- the password contained a dollar sign

- I was trying to connect from a Linux shell

The bash shell treats the dollar sign as a special character for expansion to an environment variable, so we need to escape it with a backslash. Incidentally, we don't have to do this in the case where the dollar sign is the final character of the password.

As an example, if your password is "pas$word", from Linux bash we must connect as follows:

# mysql --host=192.168.233.142 --user=root --password=pas\$word

Problem

MySQL 5.1.31 running on Windows XP. From the local MySQL server (192.168.233.142) I can connect as root as follows: ``` >mysql --host=192.168.233.142 --user=root --password=redacted ``` From a remote machine (192.168.233.163), I can see that the mysql port is open: ``` # telnet 192.168.233.142 3306 Trying 192.168.233.142... Connected to 192.168.233.142 (192.168.233.142). ``` But when trying to connect to mysql from the remote machine, I receive: ``` # mysql --host=192.168.233.142 --user=root --password=redacted ERROR 1045 (28000): Access denied for user 'root'@'192.168.233.163' (using password: YES) ``` I have only 2 entries in mysql.user: ``` Host User Password -------------------------------------- localhost root *blahblahblah % root [same as above] ``` What more do I need to do to enable remote access? EDIT As suggested by Paulo below, I tried replacing the mysql.user entry for % with an IP specific entry, so my user table now looks like this: ``` Host User Password ------------------------------------------ localhost root *blahblahblah 192.168.233.163 root [same as above] ``` I then restarted the machine, but the problem persists.

Original source

Related problems