Remote Access to MySQL database


Scenario: running a mysql server alone in a separate machine but want to connect and access the database from other machine.

Want to remotely connect to your mysql databases. ?

Yes..! its possible, Use the below command to connect your MySQL databases from remote location.

mysql -u user_name-P port_number -h host_name

user_name – name has privilege to connect remote mysql
port_number – number in which mysql is running.
host_name – remote machine name. you can also use IpAddress instead of host name.

Before execute the above command ensure that you have privileges to access that remote mysql database.If not kindly grant permissions to access and perform sql operations on that database. Lets see the command for providing permission to remote users.

grant all on *.* to username@’host_name’

*.* – enables access to all databases of the remote mysql.

you can restrict the access by changing like this.

tablename.* – set access to table level
databasename.* – set access to database level
select on *.* – set select access to all databases.

If you need more informations about grant command, go here http://dev.mysql.com/doc/refman/5.0/en/grant.html

Advertisements

Tags: , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: