Access a MySQL server from the LAN

This entry is part 8 of 9 in the series: Administering MySQL from the command line

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';

Note:
– 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)




Leave a Comment

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