MySQL 8 修改root密码ERROR 1064 (42000): You have an error in your SQL syntax;

root先利用原密码登陆

bash 复制代码
mysql -u root -p
Enter password: *******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.26 MySQL Community Server - GPL

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

2.原修改方式syntx error

bash 复制代码
mysql> set password for root@localhost = password('xxxxx');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('xxxxxx')' at line 1

3.MySQL 8对应修改方式,修改的是当前登陆用户的password

bash 复制代码
mysql> set password = 'yyyyyy';
Query OK, 0 rows affected (0.07 sec)

mysql>
相关推荐
神仙别闹1 小时前
基于Java(Spring Boot)+MySQL实现电商网站
java·spring boot·mysql
hacker_LeeFei1 小时前
Springboot连接多数据源(MySQL&Oracle)
spring boot·mysql·oracle
瀚高PG实验室1 小时前
HGDB集群(安全版)repmgr手动切换主备库
java·数据库·安全·瀚高数据库
mit6.8241 小时前
[C# starter-kit] Domain Entities | `AuditableEntity`基类 | 跟踪变化 | 软删除
数据库·microsoft·c#
潇凝子潇2 小时前
MySQL Redo Log 和 Undo Log 满了会有什么问题
数据库·mysql
周杰伦_Jay4 小时前
【Homebrew安装 MySQL 】macOS 用 Homebrew 安装 MySQL 完整教程
数据库·mysql·macos
悟能不能悟9 小时前
redis的红锁
数据库·redis·缓存
贝多芬也爱敲代码10 小时前
如何减小ES和mysql的同步时间差
大数据·mysql·elasticsearch
安当加密11 小时前
MySQL数据库透明加密(TDE)解决方案:基于国密SM4的合规与性能优化实践
数据库·mysql·性能优化
007php00711 小时前
某大厂跳动面试:计算机网络相关问题解析与总结
java·开发语言·学习·计算机网络·mysql·面试·职场和发展