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>
相关推荐
期待のcode5 小时前
MyBatisX插件
java·数据库·后端·mybatis·springboot
小萌新上大分7 小时前
mysql主从复制搭建
mysql·mysql主从复制·mysql主从复制配置·mysql主从复制的搭建·mysql主从复制的原理·mysql安装入门
安审若无7 小时前
oracel迁移数据文件至其他目录操作步骤
数据库
sunxunyong7 小时前
doris运维命令
java·运维·数据库
华仔啊8 小时前
这 10 个 MySQL 高级用法,让你的代码又快又好看
后端·mysql
小鸡吃米…8 小时前
Python PyQt6教程七-控件
数据库·python
忍冬行者8 小时前
清理三主三从redis集群的过期key和键值超过10M的key
数据库·redis·缓存
TimberWill8 小时前
使用Redis队列优化内存队列
数据库·redis·缓存
Knight_AL9 小时前
MySQL 中 UPDATE 语句的执行过程全解析
数据库·mysql
yngsqq10 小时前
兰顿蚂蚁——CAD二次开发
数据库