The first step is to allow machines to connect. This is done by removing the bind-address line from the configuration file /etc/mysql/my.cnf
Once this is done restart the database to pick up the changes
/etc/init.d/mysql restart
Once the database is restarted, we need to create database user for the remote clients. We create a user called remoteuser.
CREATE USER 'remoteuser'@'%' IDENTIFIED BY 'remoteuser';
Next, we grant all permissions to remoteuser for our database, mydatabase
GRANT ALL ON mydatabase.* TO 'remoteuser'@'%';
Finally, we set the password for the user to 'remotepassword'.
SET PASSWORD FOR 'remoteuser'@'%'=password('remotepassword');
Now external clients can connect remotely to the database and should be able to execute commands against it.
No comments:
Post a Comment