kooper
By:
kooper

Remote access to MySQL for a none-root user

December 19, 2014 1.7k 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!

1 Answer

First step:

MAKE SURE YOU TRUST THEM

Next Step:

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

bind-address            = 127.0.0.1

To this:

#bind-address            = 127.0.0.1

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;
Have another answer? Share your knowledge.