Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to change the root password for PhPMyAdmin which has 10.1.13-MariaDB by typing the following in the SQL tab and hitting on the Go button:

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

I get this error:

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

I followed this tutorial on MySQL website:

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');

Here are some screenshots: enter image description here

enter image description here

like image 741
Mona Jalal Avatar asked Dec 24 '22 04:12

Mona Jalal


1 Answers

This worked for MariaDB:

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

After you change the password you will see the following in PhPMyAdmin: enter image description here which says : mysql said: Cannot connect: invalid settings.

You should open the config.inc.php file and change the following lines:

/* 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'] = '';

To:

/* 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'] = '';

This file by default is in C:\xampp\phpMyAdmin directory.

like image 103
Mona Jalal Avatar answered Jan 13 '23 11:01

Mona Jalal