JyLie

vuePress-theme-reco JyLie    2017 - 2023
JyLie

Choose mode

  • dark
  • auto
  • light
主页
分类
  • API
  • HTML
  • css
  • vue
  • Linux
  • Docker
  • Webpack
  • WebGL
  • PixiJS
  • Github
  • BOM
  • XML
  • bug
  • ie
  • uniapp
  • IE
  • mysql
  • font
  • bom
  • canvas
  • video
  • html
  • JavaScript
  • js
  • 运算符
  • RegExp
  • 编码
  • MiniApp
  • nginx
  • Tool
  • node.js
  • cat
  • nodejs
  • protocol
  • URL
  • FLOW
  • DNS
  • Protocol
  • python
  • 安全
  • linux
  • shell
  • IDE
  • Packer
  • ViteJS
  • git
  • vendor
  • WebApp
  • WebView
  • Window API
  • webview
  • 规范
标签
时光轴
GitHub
author-avatar

JyLie

74

Article

79

Tag

主页
分类
  • API
  • HTML
  • css
  • vue
  • Linux
  • Docker
  • Webpack
  • WebGL
  • PixiJS
  • Github
  • BOM
  • XML
  • bug
  • ie
  • uniapp
  • IE
  • mysql
  • font
  • bom
  • canvas
  • video
  • html
  • JavaScript
  • js
  • 运算符
  • RegExp
  • 编码
  • MiniApp
  • nginx
  • Tool
  • node.js
  • cat
  • nodejs
  • protocol
  • URL
  • FLOW
  • DNS
  • Protocol
  • python
  • 安全
  • linux
  • shell
  • IDE
  • Packer
  • ViteJS
  • git
  • vendor
  • WebApp
  • WebView
  • Window API
  • webview
  • 规范
标签
时光轴
GitHub
  • egg-mysql连接mysql8问题

egg-mysql连接mysql8问题

vuePress-theme-reco JyLie    2017 - 2023

egg-mysql连接mysql8问题


JyLie 2023-10-13 mysqlegg-mysql

# 问题

解决egg-mysql连接不上MySql服务器报错:Client does not support authentication protocol requested by server; consider upgrading MySQL client

# 分析

查阅文档,发现是由于navicat版本的问题造成连接失败。

mysql8 之前的版本中加密规则是mysql_native_password,

而在mysql8之后,加密规则是caching_sha2_password

# 解决

将加密规则 caching_sha2_password 改为 mysql_native_password

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '[mysql_password]' PASSWORD EXPIRE NEVER;
# 关键在于修改规则
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[mysql_password]';
、、 刷新权限,使修改生效。
mysql> FLUSH PRIVILEGES; 
# 查看表中相关信息,确认修改是否真正生效
mysql> use mysql;  //先使用命令 use mysql
Database changed
mysql> select user,host,plugin from user where user='root'; // 在输入该命令
+------+-----------+-----------------------+ 
| user | host      | plugin                |
+------+-----------+-----------------------+
| root | localhost | mysql_native_password |
+------+-----------+-----------------------+
1 row in set (0.00 sec)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15