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>
相关推荐
Elastic 中国社区官方博客3 小时前
将你自己的密钥用于现有 Elastic Cloud 部署
大数据·数据库·elasticsearch·全文检索
红海云3 小时前
Jev:给智能系统做判断的模型
大数据·数据库·人工智能
wjkjpcba3 小时前
PCBA烧录程序是什么:PCBA包工包料厂家解析烧录与测试
linux·数据库·人工智能·smt贴片加工·pcba贴片加工厂
꯭自꯭闭꯭4 小时前
达梦事物特性及MVCC
linux·运维·数据库
小马同学-4 小时前
MySQL主从复制和读写分离
数据库·mysql
谢亮_vipxieliang4 小时前
Spring 事务失效的常见场景
java·开发语言·数据库·spring boot
海绵宝宝转agent4 小时前
MySql高频面试八股开源笔记总结
mysql·面试·开源
geovindu5 小时前
sql: JSON and XML Data Handling in SQL using sql server 2025
大数据·数据库·sqlserver·数据库开发·数据库架构
IT大白鼠5 小时前
图数据库系列 · 第 02 篇——架构拆解:原生图存储到因果集群
数据库·架构·nosql
余槐i6 小时前
数据没回滚也不报错:@Transactional 自调用失效的 3 种复现与修复
spring boot·mysql·多线程·spring 事务