gpt4 book ai didi

mysql - 更改用户 root@localhost 通过 mysql_native_password 识别; -- 因语法错误而失败

转载 作者:行者123 更新时间:2023-11-30 21:31:15 25 4
gpt4 key购买 nike

尝试根据以下页面启用常规的基于密码的身份验证: https://mariadb.com/kb/en/library/authentication-plugin-unix-socket/

该页面建议使用以下代码:

ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
SET PASSWORD = PASSWORD('foo');

但在我的机器上它因语法错误而失败:

MariaDB [(none)]> ALTER USER root@localhost IDENTIFIED VIA mysql_native_password;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER root@localhost IDENTIFIED VIA mysql_native_password' at line 1
MariaDB [(none)]> SET PASSWORD = PASSWORD('foo');
Query OK, 0 rows affected, 1 warning (0.00 sec)

最佳答案

如果您运行的是 MariaDB < 10.2,ALTER USER 命令将不起作用,如上所述。

要更改身份验证方法,请使用:

UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root';

关于mysql - 更改用户 root@localhost 通过 mysql_native_password 识别; -- 因语法错误而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56052177/

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