Monday, August 20, 2012

How to enable MySQL remote access on Ubuntu Server 12.04

By default MySQL on Ubuntu Server 12.04 can only be accessed from localhost (127.0.0.1). 

If we need to access it from another computer on the network, we must do the following step

Edit MySQL Configuration

$ sudo vim /etc/mysql/my.cnf

#comment out this line (add # in front of the line)
#bind-address           = 127.0.0.1

Restart the server

$ sudo service mysql restart
mysql stop/waiting
mysql start/running, process 13081

Then we need to add user info to the database

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 77
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all on [database_name].* to [user]@[ip_address] identified by '[password]'


Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye


That's all!

Reference:

http://ubuntuforums.org/showthread.php?t=799386

11 comments:

Remote access said...

Thanks for sharing the information regarding remote access! I was also searching for the valuable post.

Anonymous said...

I had to uncomment at snmpd.conf
agentAddress udp:161,udp6:[::1]:161

to listen on all interfaces

Anonymous said...

Ignore the above post from "anon". It opens up the snmp daemon and will get your box compromised.

Anonymous said...

Thanks very much for this. I've spent the last 3 hours trying to find the problem (didn't comment out the bind line) to realise all the other tutorials were for a different version of Ubuntu.

Herry Johnson said...

ARINET DBA Services is a Chicago, IL based organization established in 2013. Uniting more than 100+ years of combined involvement in giving quality Oracle database Support administrations to American organizations, we've given the diverse options about remote dba masters, remote dba organizations, remote dba reinforce, remote database, prophet remote, dba remote, database association, prophet dba reinforce, Oracle sponsorship and Oracle Consultants.

koi seo said...

thanks for sharing the good information, i got it too much..


จีคลับ
goldenslot

น้องส้มส้ม said...


For this matter, many people know very well. And I know this as well. For anyone who wants to know this, hurry to read it.


บาคาร่าออนไลน์

ข่าวกีฬา said...

"What an awesome post, I just read it from start to end. Learned something new after a long time
สล๊อตโจ๊กเกอร์"

Sagaminghahaha said...

You can write an article very much. Thank you for making a great article to read.
AFC168

Ratana said...

I like your blog,I sincerely hope that your blog a rapid increase in
traffic density,which help promote your blog and we hope that your blog is being updated.
ភ្នាល់បាល់អនឡាញ

Ufa88kh said...

Thanks for the great post! I love reading it, you can be a great writer.
wordpress
blogspot
youtube
បាការ៉ាត់