If you want to not use ssh tunnel, in my.cnf or mysqld.cnf you must change 127.0.0.1 with your local ip address (192.168.1.100) in order to have access over the Lan. example bellow:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Search for bind-address in my.cnf or mysqld.cnf
bind-address = 127.0.0.1
and change 127.0.0.1 to 192.168.1.100 ( local ip address )
bind-address = 192.168.1.100
To apply the change you made, must restart mysql server using next command.
sudo /etc/init.d/mysql restart
Modify user root for lan acces ( run the query's bellow in remote server that you want to have access )
[email protected]:~$ mysql -u root -p
..
CREATE USER 'root'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
If you want to have access only from specific ip address , change 'root'@'%' to 'root'@'( ip address or hostname)'
CREATE USER 'root'@'192.168.1.100' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.100' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Then you can connect:
nobus@xray:~$ mysql -h 192.168.1.100 -u root -p
tested on ubuntu 18.04 server
10061
= Connection refused – Danny Beckett-p
flag without the password, so the password isn't saved in your bash history. – reynoldsnlp