windows远程连接MySQL失败

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了windows远程连接MySQL失败相关的知识,希望对你有一定的参考价值。

参考技术A

mysql我用的是apt安装的,有很多问题,建议大家用二进制程序安装。

问题描述
在服务器上登录MySQL只能用本地的127.0.0.1地址,用服务器本身地址会提示拒绝访问

尝试修改MySQL远程访问权限

修改后发现没有用,MySQL依然拒绝远程访问
查看3306端口
root@sfpql:~# netstat -an|grep 3306

修改MySQL服务地址:

尝试远程连接
telnet sfpql 3306

结语
MySQL远程连接不上是常见问题,一般设置好MySQL的远程访问权限就可以了。
apt安装的MySQL会自己将启动地址设置在本地,同时apt安装的MySQL的服务查看命令是 systemctl status mysql 其他安装方式的常看命令是 systemctl status mysqld

linux 安装mysql8 设置远程连接失败的问题

1、数据库安装完,设置远程连接 ,参考链接:https://blog.csdn.net/yunyexiangfeng/article/details/82876964

通常grant all privileges on *.* to ‘user‘@‘%‘ identified by ‘passowr‘;命令授权远程连接操作。(失败)

mysql的官方文档,原来这个特性被移除了,下面看文档说明:

Using GRANT to modify account properties other than privilege assignments. This includes
authentication, SSL, and resource-limit properties. Instead, establish such properties at account-creation
time with CREATE USER or modify them afterward with ALTER USER
使用grant修改账户权限分配以外的账户属性。包括认证,SSL,和资源限制配置等。取而代之的是创建用户create user或者创建后修改alter user的方式。

可以使用以下方式:

1.alter user set user.host=‘%‘ where user.user=‘root‘,此时印证官方doc说的使用alter user

2.create user ‘userName‘@‘%‘ identified ...,创建新用户,此时使用create user

工具登录数据库问题:

mysql8密码加密方式的更改:

之前默认是mysql_native_password,现在改为caching_sha2_password。很多连接工具,像nivacat12,仍然使用默认的mysql_native_password,所以在连接的时候回报错:

1251:Client does not support authentication protocol requested by server; consider upgrading
MySQL client

此时需要将mysql.user表中的plugin字段修改下:

ALTER USER user IDENTIFIED WITH mysql_native_password BY ‘password‘;

以上是关于windows远程连接MySQL失败的主要内容,如果未能解决你的问题,请参考以下文章

QT中怎样连接MYsql数据库,远程连接数据库等

mysql远程连接失败解决方法

远程连接云服务器上的mysql失败问题解决

远程连接云服务器上的mysql失败问题解决

windows远程连接失败问题排查思路

怎样连接远程mysql数据库?