Archive

Posts Tagged ‘permission’

MySQL error 1045 (28000): Access denied for user …

June 16th, 2009

Hello everybody,

Today, my task is configuring a MySQL server to allow connections from remote computers. The problem I has met is that although port 3306 on the router was already opened, users from internet still could not connect to my MySQL Server. Here is my error message:

tuyent@local:~$ mysql -u tuyent -p -h remote-computer
Enter password: 
ERROR 1045 (28000): Access denied for user 'tuyent'@'local' (using password: YES)

Well, here is my solution:
- Step 1: Double check that the port 3306 is already opened.
- Step 2: Open MySQL configuration file (/etc/mysql/my.cnf), comment the line

# bind-address            = 127.0.0.1

- Step 3: Restart the MySQL server

$ sudo /etc/init.d/mysql restart

- Step 4: Go to mysql command line and grant permission for user

mysql> grant all on *.* to 'tuyent'@'%' identified by 'password';
mysql> grant all on *.* to 'tuyent'@'localhost' identified by 'password';
mysql> flush privileges;

Note: Remember to grant permission on both from localhost and from anywhere (’%’ indicator), and flush all privileges.

Works fine for me :)

Administration, Coding , , , , ,