我正在尝试更改具有 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
我关注了this tutorial在 MySQL 网站上:
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
目录中。
关于mysql - 检查与您的 MariaDB 服务器版本对应的手册以了解正确的语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38231170/