gpt4 book ai didi

MySQL:尝试为 root 设置密码,SQL 语法错误

转载 作者:行者123 更新时间:2023-11-29 06:13:56 25 4
gpt4 key购买 nike

这段代码来自Learning MySQL and MariaDB一书:

mysql -u root -p -e "SET PASSWORD FOR 'root'@'127.0.0.1' PASSWORD('new_pwd');"

我收到这个错误:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for th
e right syntax to use near 'PASSWORD('new_pwd')' at line 1

这本书对吗?这个语法是不是很旧?有什么问题?

最佳答案

尝试:

mysql -u root -p -e "SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new_pwd');"

关于MySQL:尝试为 root 设置密码,SQL 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36922827/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com