Tags

If you encountered an error that look something like this Access denied for user root@mylocalpc (using password: YES)
it means that the mylocalpc dont have permission to access your remote database.
To fix the problem, you need to grant the user access to mylocalpc server. See the mysql command below:

$ mysql -u root -p webdevel
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'webdevel' WITH GRANT OPTION;
Query OK, 0 rows affected (0.04 sec)

# It is advisable to create a new 'user' instead of root
mysql> CREATE USER 'user'@'mylocalpc' IDENTIFIED BY 'password'; 
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user'@'mylocalpc' WITH GRANT OPTION;
Query OK, 0 rows affected (0.04 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.04 sec)

# Check if the hostname is added by executing select query below
mysql> SELECT user,host FROM mysql.user;
4 rows in set (0.00 sec)

Once you've successfully created a user, you can now use that account to connect the DB using MYSQL Workbench or any DB tools.

Thats it..
Advertisements