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>
相关推荐
庸子4 分钟前
MySQL从入门到DBA深度学习指南
数据库·mysql·dba
cookqq9 分钟前
mongodb源码分析session执行handleRequest命令find过程
数据库·sql·mongodb·nosql
haciii10 分钟前
深入理解数据库隔离级别与Spring Boot事务管理
spring boot·mysql
Bro_cat11 分钟前
MongoDB 入门指南:安装、配置与 Navicat 连接教程
数据库·mongodb
不太可爱的大白15 分钟前
洞悉 MySQL 查询性能:EXPLAIN 命令 type 字段详解
数据库·mysql
l1t1 小时前
DeepSeek辅助实现的DuckDB copy to自定义函数
数据库·c++·人工智能
懵逼的小黑子1 小时前
mysql修改字段类型
数据库·mysql
写bug写bug1 小时前
SQL窗口函数原理和使用
后端·sql·mysql
Tapdata1 小时前
拒绝停服,随时回退:MS SQL 到 ≈ 的无缝数据库双向迁移方案
数据库
失败又激情的man1 小时前
python爬虫之数据存储
前端·数据库·python