Remote access to MySQL for a none-root user

Posted December 19, 2014 3.5k views

Hello! I have a droplet on Ubuntu with RoR, rvm and MySQL are installed and configured.
I dont have the source code, itll should be downloaded by the other man, through the remote access.
He asked my to open him access to a new, none-root user, access to DB and the way, where he can download files with the RoR application.
What do I have to do?
Much thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

First step:


Next Step:

edit /etc/mysql/my.cnf
change this line (if it exists)

bind-address            =

To this:

#bind-address            =

restart MySQL:

service mysql restart

add rule in the firewall:

ufw allow from any to any port 3306

Finally, grant them access in MySQL. This example assumes the user is “remoteuser”, the password is “remotepassword” and database is “local_db”. Change to match what you need. If you need full access:

GRANT ALL PRIVILEGES ON local_db.* to 'remote_user'@'%' IDENTIFIED BY 'remote_password'; FLUSH PRIVILEGES;

For most rights, but not full rights:

GRANT SELECT,UPDATE,INSERT ON local_db.* to 'remote_user'@'%' IDENTIFIED BY 'remote_password'; FLUSH PRIVILEGES;

For Read-Only:

GRANT SELECT ON local_db.* to 'remote_user'@'%' IDENTIFIED BY 'remote_password'; FLUSH PRIVILEGES;