我已经在Linux Ubuntu 18.04上全新安装了MariaDB服务器(10.1.34)
我用以下命令启动了SQL Shell:
sudo -i
mysql -uroot -p -h localhost
外壳打开。 我想更改密码以与Node.js typeorm和mysql驱动程序兼容(因为我总是得到此error),并且具有以下内容:
ALTER USER root@localhost IDENTIFIED BY '12345';
它总是说我的语法有错误,但是我在线检查,甚至在MariaDB ALTER USER site上也是如此。这是怎么了? 我尝试过:
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';
但是没有任何效果。我总是会遇到语法错误,但是我不知道在哪里出错。有人可以指出我的错误吗?
答案 0 :(得分:0)
来自https://mariadb.com/kb/en/library/alter-user/:
MariaDB 10.2.0中引入了ALTER USER语句。
另请参见较旧的$data = 'grant_type=password';
$data .= '&username='.$username;
$data .= '&password='.$password;
$data .= '&client_id='.$client_id;
$data .= '&client_secret='.$client_secret;
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $ep_token_issuance,
CURLOPT_POST => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_RETURNTRANSFER => true,
));
$result = curl_exec($ch);
//print_r(curl_getinfo($ch));
curl_close ($ch);
:https://mariadb.com/kb/en/library/set-password/