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 小时前
【嵌入式linux学习_OV8858 bring up】L2_V4L2与Ov8858
linux·数据库·学习
菜地里的小菜鸟1 小时前
达梦数据库备份与恢复
数据库·达梦·达梦数据库备份与恢复
阳光九叶草LXGZXJ3 小时前
达梦数据库-报错-11-cmd 13 validate error
linux·运维·数据库·sql·学习
PGCCC4 小时前
PostgreSQL 数据库认证体系技术解析:PCA / PCP / PCM 三级能力模型与考纲拆解
数据库·postgresql·pcm
wWYy.4 小时前
Mysql:覆盖索引
android·数据库·mysql
long3164 小时前
PostgreSQL 学习资料 · 入门 / 练习 / 精通 / 扩展
java·数据结构·数据库·spring boot·sql·postgresql·数据库开发
拳里剑气4 小时前
Linux:进程间通信
linux·运维·数据库·进程
阳光九叶草LXGZXJ4 小时前
达梦数据库-报错-12-[-7184]:对象定义[XXX]被修改,版本检查失败
linux·运维·服务器·数据库·sql·学习
惜分飞4 小时前
Oracle Block Edit Tool (obet) 功能增强–2026.07
数据库·oracle·obet
无忧.芙桃4 小时前
MySQL数据库原理与实践(五):内置函数
数据库·mysql