Remote MySQL access from command line

This tutorial will walk you through setting up a user on your MySQL server to connect remotely.

1. You have access to login as the 'root' MySQL user
2.#mysql -u root -p
3. This will prompt you for your MySQL root password.

4. Once you are logged into MySQL you need to issue the GRANT command that will enable access for your remote user. In this example, user 'dbUser' that will have full access to the 'testDatabase' database.

mysql> GRANT ALL ON testDatabase.* TO dbUser@'remote_server_ip' IDENTIFIED BY 'dbUser_password';

5. This statement will grant ALL permissions to the user dbUser.

6.Now you can test your connection remotely. You can access your MySQL server from another Linux server:
mysql -h remote_server_ip -P 3306 -u -d -p

Was this article helpful?

mood_bad Dislike 2
mood Like 1
visibility Views: 9051