Connect to a MySQL server from the LAN

MySQL has a refined security scheme, see MySQL: administration of users, but some time is necessary to allow a user to connect to our MySQL server from any computer on the Local Area Network, let's have a development server: devsrv and can make ssh:

1. Connect to devsrv via ssh
$ ssh desrv
2. We access the MySQL Server (localhost) as root
$ mysql -u root -p
3. Set permission to the usr: sedlav
grant all on *.* to 'sedlav'@'172.16.2.%' identified by 'clave';

– We set to the users sedlav, all permissions to all databases and perhaps this is not desired it, adjust the privileges according your needs.
-172.16.2. % is my LAN set this value to your working environment

4. Refresh privileges
flush privileges;

Recommended reading

-help grant (MySQL)
-help flush (MySQL)

YouTube video

Administering MySQL from the command line, 14 (15)

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.