HostOnNet Blog

Ubuntu 16.04 PhpMyAdmin root login problem

On Ubuntu 16.04 when i login to PhpMyAdmin with user root, i get error

#1698 - Access denied for user 'root'@'localhost'

Ubuntu phpmyadmin root login

This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket”.

root@backup:~# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 62
Server version: 10.0.31-MariaDB-0ubuntu0.16.04.2 Ubuntu 16.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT User, Host, plugin FROM mysql.user;
+------------+-----------+-------------+
| User       | Host      | plugin      |
+------------+-----------+-------------+
| root       | localhost | unix_socket |
| phpmyadmin | localhost |             |
+------------+-----------+-------------+
2 rows in set (0.00 sec)

MariaDB [(none)]>

To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt.

use mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;

See PhpMyAdmin


Posted in Ubuntu. Bookmark the permalink.