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>
相关推荐
spencer_tseng1 天前
mysql uuid()
mysql·uuid
傻啦嘿哟1 天前
用Redis实现爬虫URL去重与队列管理:从原理到实战的极简指南
数据库·redis·爬虫
冒泡的肥皂1 天前
2PL+MVCC看一些场景
数据库·后端·mysql
岁岁岁平安1 天前
python mysql-connector、PyMySQL基础
python·mysql·pymysql
码农阿豪1 天前
从权限混沌到安全有序:金仓数据库的权限隔离如何超越MySQL
数据库·mysql·安全
不剪发的Tony老师1 天前
SQL Schema Compare:一款免费开源的数据库结构比较和同步工具
数据库
寒秋丶1 天前
Milvus:集合(Collections)操作详解(三)
数据库·人工智能·python·ai·ai编程·milvus·向量数据库
寒秋丶1 天前
Milvus:Schema详解(四)
数据库·人工智能·python·ai·ai编程·milvus·向量数据库
kyle~1 天前
CPU调度---协程
java·linux·服务器·数据库·c++20
IDOlaoluo1 天前
SQL Server 2017 Developer 中文版安装教程(64位 ISO 文件详细步骤)
服务器·数据库·负载均衡