Question

Remote access to MySQL for a none-root user

  • Posted December 19, 2014

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!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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 “remote_user”, the password is “remote_password” 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;