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>
相关推荐
2501_941805934 小时前
在大阪智能零售场景中构建支付实时处理与高并发顾客行为分析平台的工程设计实践经验分享
数据库
李慕婉学姐4 小时前
【开题答辩过程】以《基于JAVA的校园即时配送系统的设计与实现》为例,不知道这个选题怎么做的,不知道这个选题怎么开题答辩的可以进来看看
java·开发语言·数据库
珠海西格电力4 小时前
零碳园区有哪些政策支持?
大数据·数据库·人工智能·物联网·能源
哈里谢顿5 小时前
记录一次sql优化记录
mysql
数据大魔方5 小时前
【期货量化实战】日内动量策略:顺势而为的短线交易法(Python源码)
开发语言·数据库·python·mysql·算法·github·程序员创富
Chasing Aurora5 小时前
数据库连接+查询优化
数据库·sql·mysql·prompt·约束
倔强的石头_5 小时前
【金仓数据库】ksql 指南(六)—— 创建与管理用户和权限(KingbaseES 安全控制核心)
数据库
小熊officer6 小时前
Python字符串
开发语言·数据库·python
渐暖°6 小时前
JDBC直连ORACLE进行查询
数据库·oracle
萧曵 丶7 小时前
Next-Key Lock、记录锁、间隙锁浅谈
数据库·sql·mysql·mvcc·可重复读·幻读