检查与您的 MariaDB 服务器版本对应的手册以了解正确的语法

check the manual that corresponds to your MariaDB server version for the right syntax

我正在尝试更改具有 10.1.13-MariaDB 的 PhPMyAdmin 的根密码 通过在 SQL 选项卡中键入以下内容并点击 Go 按钮:

ALTER USER
  'root'@'localhost' IDENTIFIED BY 'mypass'

我收到这个错误:

Error
SQL query:


ALTER USER
  'root'@'localhost' IDENTIFIED BY 'mypass'
MySQL said: Documentation

1064 - 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 BY 'mypass'' at line 1

我在 MySQL 网站上关注了 this tutorial

Create a text file containing the password-assignment statement on a single line. Replace the password with the password that you want to use.

MySQL 5.7.6 and later:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'

MySQL 5.7.5 and earlier:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');

以下是部分截图:

这适用于 MariaDB:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass')

更改密码后,您将在 PhPMyAdmin 中看到以下内容: 表示:mysql said: Cannot connect: invalid settings.

您应该打开 config.inc.php 文件并更改以下行:

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

收件人:

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'newpass';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Lang'] = '';

此文件默认位于 C:\xampp\phpMyAdmin 目录中。