提问者:小点点

尝试在MariaDB shell中重置Root密码时出现语法错误


我已经安装MariaDB-server(10.1.34)新鲜LinuxUbuntu 18.04

我已经启动了一个SQLshell:

sudo -i
mysql -uroot -p -h localhost

外壳打开。我想更改我的密码以与Node. js typeorm和mysql驱动程序兼容(因为我总是得到这个错误),如下所示:

ALTER USER root@localhost IDENTIFIED BY '12345';

它总是说我的语法有错误,但我在网上检查过,它甚至在MariaDBs ALTER USER网站上。这里出了什么问题?我试过了:

ALTER USER root@localhost IDENTIFIED BY '12345';
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345';
ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY '12345';
ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '12345';

但是什么都不行。我总是得到语法错误,但是我不知道我在哪里犯了错误。有人能指出我的错误吗?


共1个答案

匿名用户

从https://mariadb.com/kb/en/library/alter-user/:

ALTER USER语句是在MariaDB 10.2.0中引入的。

另请参阅旧的SETPASSWORD:https://mariadb.com/kb/en/library/set-password/