【问题标题】:check the manual that corresponds to your MariaDB server version for the right syntax检查与您的 MariaDB 服务器版本相对应的手册以获取正确的语法
【发布时间】:2016-11-08 22:16:15
【问题描述】:

我正在尝试更改具有 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 - 您的 SQL 语法有错误;检查与您的 MariaDB 服务器版本相对应的手册,以获取在“用户”附近使用的正确语法 'root'@'localhost' IDENTIFIED BY 'mypass'' 在第 1 行

我在 MySQL 网站上关注了this tutorial

创建一个包含密码分配语句的文本文件 单线。将密码替换为您想要的密码 使用。

MySQL 5.7.6 及更高版本:

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

MySQL 5.7.5 及更早版本:

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

以下是一些截图:

【问题讨论】:

  • 您使用的是哪个版本的 MySQL/MariaDB?
  • 我刚刚从 Apache Friend 安装了 XAMPP,它在 Windows 7 上安装了所有其他东西,包括 PhPMyAdmin 和 MySQL
  • OK - 您使用的是什么版本的数据库?
  • @JayBlanchard 10.1.13-MariaDB

标签: mysql sql phpmyadmin mariadb


【解决方案1】:

这适用于 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目录下。

【讨论】:

  • 感谢分享和记录。
  • 欢迎您@Drew!想节省未来开发人员的时间:)
猜你喜欢
  • 1970-01-01
  • 2022-08-04
  • 2016-06-17
  • 2017-02-11
  • 2021-05-12
  • 2018-11-27
  • 2019-10-24
  • 1970-01-01
  • 2020-02-22
相关资源
最近更新 更多