Remote connect to mysql database

1. mysql server installed on windows
if you want to connect the mysql server from the remote windows cliect,
you need to modify the user table of mysql database in mysql server, as follow:
update user set host = '%' where user = 'root';
or
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;(Note: password is root user's password)

if you want to connect to mysql server from a bind machine, you can execute the command:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.8' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
so you can connect to mysql server from the 192.168.1.8 machine.

grant definition: grant rights on database's object to user
localhost: express you can login mysql server from localhost
%: express you can login from any machine in your network

2. mysql server installed on linux
  if you want to connect the mysql server from the remote windows client, please follow the 1 step above.
  if you can't login yet, you can modify the /etc/mysql/my.cnf file, remove or comment the "bind-address = 127.0.0.1" sentence,
  this sentence express the mysql server only listen to the localhost machine.

你可能感兴趣的:(linux,mysql,windows)