[MySQL] 解决Error 1698: Access denied for user 'root'@'localhost'
2023-02-18 15:41:50 时间
当程序中使用root账号连接mysql时报以下错误,但是使用命令行是可以正常连接的,那么就查询下mysql数据库的user表,查看下当前用户的密码加密方式,看看是不是unix_socket
MariaDB [mysql]> select user,plugin from user;
+------+-------------+
| user | plugin |
+------+-------------+
| root | unix_socket |
+------+-------------+
可以更改下用户的加密方式:
update user set authentication_string=password("123456"),plugin='mysql_native_password' where user='root';
相关文章
- 一起来学redis-redis数据结构
- 一起来学redis-redisObject
- 一起来学redis-持久化
- 一起来学redis redission
- netfilter 五链四表 - 为什么服务器没有监听 80 端口却被k3s占用了
- RedisRoad - 01 Redis 的基本操作
- RedisRoad - 02 数据类型 String
- RedisRoad - 03 数据类型: List 列表
- RedisRoad - 04 数据类型 Set 集合
- RedisRoad - 05 数据类型 ZSet 有序集合
- RedisRoad - 06 数据类型 Hash 映射
- RedisRoad - redis 使用 unlink 删除大 key
- 【开个坑】 kustz 快速发布应用到 Kubernetes
- kustz 从零开始写一个 kubernetes 发布管理工具(汇总)
- 算法学习——递推之猴子爬山
- 算法学习——递推之超级素数
- 算法学习——枚举之完美综合式
- 算法学习——递归之排队购票问题
- 算法学习——枚举之超级方程
- 算法学习——枚举之最简真分数