Enabling Remote Access To MySQL

I recently set up a virtual machine with Linux running on it to test stuff out. I ran into the issue which I have solved many times when I had installed my server at home which has a LAMP set up. By default MySQL restricts access to the database to only root (because this is the only account that have been created) and on the local machine access only.

First edit the MySQL configuration file. On Fedora this is located at:
/etc/my.cnf
and comment out or delete this line:

bind-address 127.0.0.1

to

#bind-address 127.0.0.1

Save the file and edit the permissions in mysql
mysql -u root -p
A password prompt for root should appear. Once logged into MySQL execute this command:
GRANT ALL PRIVILEGES ON *.* TO ''@'%' IDENTIFIED BY 'password'

where:

Restart MySQL:
sudo /etc/init.d/mysql restart

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux, Networking, Software and tagged , , , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.