gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 04:06:10 26 4
gpt4 key购买 nike

我正在尝试更改具有 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');

以下是部分截图: enter image description here

enter image description here

最佳答案

这适用于 MariaDB:

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

更改密码后,您将在 PhPMyAdmin 中看到以下内容: enter image description here其中说: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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com