Remote connect to mysql database
  nzOJE50ROQlt 2023年11月02日 64 0


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.

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  xaeiTka4h8LY   2024年05月31日   32   0   0 MySQL索引
  xaeiTka4h8LY   2024年05月31日   44   0   0 MySQLSQL
  xaeiTka4h8LY   2024年05月31日   28   0   0 字段MySQL
  xaeiTka4h8LY   2024年05月31日   38   0   0 MySQL数据库
  xaeiTka4h8LY   2024年05月17日   46   0   0 MySQLgithub
  xaeiTka4h8LY   2024年05月17日   37   0   0 MySQL数据库
  xaeiTka4h8LY   2024年04月26日   48   0   0 centoslinuxredis
nzOJE50ROQlt