【mysql】远程连接服务器数据库出现 Client does not support authentication protocol requested by server的解决方法
前言
之前已经配好了本地数据库与云服务器上的数据库的连接,也能正常进行操作。几个月后某天打开navicat想打开此连接却弹出了个错误提示窗口,显示Client does not support authentication protocol requested by server; consider upgrading MySQL client。访问服务器上的项目也是出现了数据库连接异常的信息。
解决方法
1.在服务器的mysqld配置文件中加入skip-grant-tables这句话
用xshell远程连接服务器后输入mysql -u root -p 且输入之前设置过的root密码后发现登不进去,于是在mysqld配置文件中加入了skip-grant-tables,作用就是让你不用密码就可以登入mysql。:wq保存退出后输入:service mysql restart,重新启动mysql。
2.发现mysql的user表里没有root用户
创建root用户
create user 'root'@'localhost' identified by '数据库密码';
此步骤可能会报以下错误
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
可以用以下方法解决
输入:flush privileges;
此时再次重新创建root用户
create user 'root'@'localhost' identified by '数据库密码';
如果再次报错,则输入这个命令
drop user 'root'@'localhost';
再次重新创建用户
create user 'root'@'localhost' identified by '数据库密码';
结果没有再报错,root用户创建成功。
输入: flush privileges; 再次刷新一下
输入:exit; 退出数据库
此时删除mysqld配置文件中的skip-grant-tables
输入:service mysql restart,重新启动mysql。
3.把root用户的host项从localhost改为%
当前的root用户的host的值是localhost,服务器上的项目和本地数据库都没法访问到服务器上的数据库。所以需要把localhost改为%
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
mysql> flush privileges;
如果服务器防火墙没有开放3306端口的话还需开放一下
到此这个问题就解决了。都可以正常连接和访问了
【mysql】远程连接服务器数据库出现 Client does not support authentication protocol requested by server的解决方法相关推荐
- nodejs连接mysql数据库,报错Client does not support authentication protocol requested by server的解决方法
nodejs连接mysql数据库,报错Client does not support authentication protocol requested by server的解决方法 参考文章: (1 ...
- 终极解决navicat远程mysql8报错 1251 Client does not support authentication protocol requested by server
朋友使用mysql8,跟我讲不能远程了,看了一下,环境变量没配, MYSQL_HOME=mysql安装bin目录 PATH追加%MYSQL_HOME% 配了环境变量还不行 于是发现一个惊天大秘密 就是 ...
- Client does not support authentication protocol requested by server;
Navicat连接MySQL Server8.0版本时出现Client does not support authentication protocol requested by server:解决 ...
- nodejs连接mysql报错:Client does not support authentication protocol requested by server; consider upgrad
由于本人是前端,mysql只是偶尔做一下小项目会用到,大概一年没有用了. 今天用mac通过brew下载了一个8.0.12版本的mysql;然后用egg进行连接,egg是阿里封装的一个nodejs框架. ...
- 使用NodeJS连接到MySQL数据库Client does not support authentication protocol requested by server; consider upg
使用NodeJS连接到MySQL数据库时,运行项目,出现如下错误: throw err; // Rethrow non-MySQL errors^Error: ER_NOT_SUPPORTED_AUT ...
- 解决: Client does not support authentication protocol requested by server; consider upgrading MySQL
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 在服务器上把 mysql 装好后,运行起来. 2. navicat 死活连接不上,在网上查说是 ...
- “1251 – Client does not support authentication protocol requested by server;consider upgrading MySQL
本文由 比特飞 原创发布,欢迎大家踊跃转载. 转载请注明本文地址:"1251 – Client does not support authentication protocol reques ...
- Client does not support authentication protocol requested by server;consider upgrading MySQL
Client does not support authentication protocol requested by server;consider upgrading MySQL 在测试node ...
- navicat连不上mysql client does not support authentication protocol requested by server; consider upgrad
当通过windows主机navicat连接虚拟的mysql时报如下错误.Client does not support authentication protocol requested by ser ...
最新文章
- steam自建服务器游戏_虽有差评销量却还是直步青云,《Atlas》力登Steam榜单前茅...
- 赠书 | 图像分类问题建模方案探索实践
- 使用php分页类实现简单分类
- python项目开发案例-Python项目开发案例集锦 PDF 全彩超清版
- 【开发环境】Mac 中删除 Python ( 删除 Python 框架 | 删除 Python 应用程序 | 删除 Python 链接 )
- Boost:循环缓冲区总和的测试程序
- Java提高篇 —— Java三大特性之多态
- Ubuntu 16.04安装UML工具StarUML 2
- JavaSE基础——数组概述和定义格式说明
- 企业微信oauth认证_企业微信开发之授权登录
- 程序员的你不可不知的数据库northwind
- sb 讲解 (!(~+[])+{})[--[~+][+[]]*[~+[]] + ~~!+[]]+({}+[])[[~!+[]]*~+[]]
- java do po dto_彻底搞懂DAO,PO,BO,DTO,VO,DO
- 2018年度总结(人若无名,专心练剑)
- 对于iPhone描述文件的签名认证
- Akka in 2 weeks
- 【区块链技术开发】 Solidity使用Truffle Box工具实现预构建模板、自动化部署、创建智能合约示例代码
- Struts2自定义类型转换器
- 【论文】AMC:AutoML用于移动设备上的模型压缩和加速
- SymPy:如何用 Python 求解微积分