mysql - 更新或更改表根用户的 SQL 语法错误
问题描述
新安装后ubuntu 20.04
我得到错误与root
用户连接到mysql。使用后的以下命令
sudo mysqld_safe --skip-grant-tables --skip-networking
mysql -u root
我收到语法错误,无法更新 root 密码:
mysql版本:
mysql Ver 8.0.22-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
命令:
update `user` set `authentication_string`=PASSWORD("") where `User`='root';
>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 '("") where `User`='root'' at line 1
当我尝试使用Alter
命令时,我收到此消息:
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
>ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决方案
尝试使用单引号,而不是双引号或设置密码不要使用空字符串
update user set `authentication_string`=PASSWORD('') where user='root';
或者
update user set `authentication_string`=PASSWORD('yourpassword') where user='root';
然后冲洗!
flush privileges;
推荐阅读
- python - python - 功率谱的频率
- class - 使用模板将多态类重写为一个类(编译时多态)
- javascript - 如何创建一个带有 4 个按钮的页面来播放 gdrive 中的音频?
- swiftui - SwiftUI TabView Page 如何处理大数据
- graphql - 如何为其他字段组织 GraphQL 解析器
- liferay - Liferay - 使用外部 REST 服务填充文本字段的形式
- ios - UIScrollView 是否会自动调整 contentOffset 以适应安全区域?
- javascript - Vue.js - 访问应用程序实例的辅助函数
- matlab - 使用 Matlab 填充文本字段并单击网页上的按钮
- node.js - 使用 chokidar 限制异步文件观看