Lets try to allow mysql to grant access from remote machines.
Lets assume, Machine1 tries to connect to Machine2's MySQL Database.
Machine1 IP: 192.168.1.1
Machine2 IP: 192.168.1.2
Configuration Steps :
1. On Machine2, edit the /etc/mysql/my.cnf configuration file
Note :This might require superuser privileges.
1.1 Modify the below line in my.cnf file
bind-address = 127.0.0.1
with
#bind-address = 127.0.0.1
Basically, we are making Machine2 to listen connections from
remote machines.
2. On Machine2, Execute the below command in MySQL Command Prompt
mysql>GRANT ALL ON *.* to root@192.168.1.1 IDENTIFIED BY 'machine1pwd';
mysql>FLUSH PRIVILEGES;
Syntax: GRANT ALL ON *.* to machine1-user-name@machine1-ip IDENTIFIED BY 'machine1-password';
3. Restart the MySQL Server on Machine2
/etc/init.d/mysql restart
4. Time to do a test.
From Machine1's Terminal, execute the below command
>mysql -u root -h 192.168.1.2 -pmachine1pwd;
This should take you to Machine2's MySQL Command Prompt.
That's it.
No comments:
Post a Comment