我正在尝试更改具有10.1.13-MariaDB的PhPMyAdmin的root密码
通过在SQL选项卡中键入以下内容并点击Go
按钮:
ALTER USER
'root'@'localhost' IDENTIFIED BY 'mypass'
我收到此错误:
Error
SQL query:
ALTER USER
'root'@'localhost' IDENTIFIED BY 'mypass'
MySQL said: Documentation
1064 - 您的SQL语法出错;查看与您的MariaDB服务器版本对应的手册,以便在'USER附近使用正确的语法 'root'@'localhost'在第1行''mypass''识别
我在MySQL网站上关注this tutorial:
在a上创建一个包含密码赋值语句的文本文件 单线。用您想要的密码替换密码 使用
MySQL 5.7.6及更高版本:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'
MySQL 5.7.5及更早版本:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
答案 0 :(得分:4)
这适用于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
目录中。