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.
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.
本文详细介绍了如何在Windows和Linux环境下配置MySQL服务器,以便从远程客户端进行连接。主要内容包括修改MySQL用户表设置允许远程访问、授予特定IP地址权限以及调整配置文件等步骤。
8639

被折叠的 条评论
为什么被折叠?



