Mysql 8 远程访问 [英] Mysql 8 remote access

查看:45
本文介绍了Mysql 8 远程访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常会正确设置MySQL以进行远程访问.

I usualy setup correctly MySQL for having remote access.

目前我只能使用MySQL 8.

And currently I got stuck with MySQL 8.

第一件事是在mysql.conf.d/mysqld.cnf上,我没有任何绑定地址行,因此我手动添加了它(绑定地址0.0.0.0)我授予了对用户%"的访问权限

The first thing is that on the mysql.conf.d/mysqld.cnf , I don't have any bind-address line, so I added it by hand (bind-address 0.0.0.0) And I granted access to the user on '%'

连接后,我收到消息身份验证失败"

When I connected I got the message "Authentication failed"

但是它在localhost/命令行上运行良好

But it works well on localhost/command line

推荐答案

  1. my.ini 文件中删除或注释 bind_address 参数.
  1. Delete or comment the bind_address parameter from the my.ini file.

(文件名因操作系统而异.在Linux上,my.ini是实际上my.cnf位于目录/etc/mysql/)

(The file name is different depend on the OS. On Linux my.ini is actually my.cnf located in directory /etc/mysql/)

  1. 重新启动服务.
  2. 创建 root 用户(是,是新用户,因为存在的是'root @ localhost',仅本地访问):

  1. Restart the service.
  2. Create the root user (yes, a new user because what exists is 'root@localhost' which is local access only):

创建用户'root'@'%'由'123'标识;

授予特权:

打开所有特权*.*到'root'@'%';

对于 DBA 用户,在最后添加 WITH GRANT OPTION .

例如使用格兰特选项创建用户'root'@'%'由'123'标识;


因为它不起作用使用GRANT创建吗?

MySQL 8 不能再使用 GRANT 创建用户,因此,如果您尝试使用 IDENTIFIED BY'123'出现错误与 GRANT 一起使用,这是最常见的错误.

MySQL 8 can no longer create a user with GRANT, so there is an error in IDENTIFIED BY '123' if you try to use it with GRANT, which is the most common error.

这篇关于Mysql 8 远程访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆