post configuration of mysql in ubuntu : allow database access to remote system

Configuration changes on MySQL to accept remote connections from a particular ipaddress

    If you are using Debian Linux file is located at /etc/mysql/my.cnf location
    If you are using Red Hat Linux/Fedora/Centos Linux file is located at /etc/my.cnf location
    If you are using FreeBSD you need to create a file /var/db/mysql/my.cnf

now edit my.cnf depending on your Linux
vi /etc/mysql/my.cnf

Make sure line skip-networking is commented
Add line, go to the line bind-address and repalce 127.0.0.1 to your sql server IP
bind-address=YOUR-SERVER-IP
exit my.cnf file after saving...
/etc/init.d/mysql restart

  open mysql prompt
 mysql -u root -p mysql
 GRANT ALL ON yourdatabasename.* TO username@'your-ipaddress' IDENTIFIED BY
'PASSWORD';

Note: your databasename is replace by your database name and your-ipaddress  is replaced by ip address of remote machine from  which you want to connect to MySql database

No comments:

Post a Comment