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>
相关推荐
dfdfadffa6 小时前
如何用模块化方案组织一个可扩展的前端组件库项目
jvm·数据库·python
2301_812539676 小时前
SQL中如何高效实现分组数据的批量更新_利用窗口函数与JOIN
jvm·数据库·python
2501_901200536 小时前
如何实现SQL存储过程存储过程参数标准化_统一命名规范
jvm·数据库·python
运气好好的6 小时前
Golang怎么用embed嵌入SQL文件_Golang如何将SQL迁移文件嵌入Go程序统一管理【技巧】
jvm·数据库·python
念何架构之路7 小时前
MySql常见ORM
数据库·mysql
平凡码工人7 小时前
navicat 17 lite 安装教程
mysql
xcLeigh7 小时前
KES数据库安全、权限、审计实战
数据库·安全·备份·权限·审计·ssl加密·密码策略
zjy277778 小时前
c++如何实现日志文件的异步落盘功能_基于无锁队列方案【附代码】
jvm·数据库·python
河阿里8 小时前
SQL:深分页问题深度解析
数据库·sql
wang3zc8 小时前
JavaScript中函数声明位置对解析器预编译的影响
jvm·数据库·python