Grant all privileges to root@localhost for mariadb or mysql on ubuntu 16.04 to use phpmyadmin

User Avatar
👤 admin
🔴 Admin
✍️ The most important thing in the world is to not be alone.
⏳ Last active: 15 Apr 2025 at 16:01
📅 Created: 14 Feb 2021 at 20:14
👀 Viewed: 41 times
✉️ Send Email

If you have ever had a problem to login to phpmyadmin with root you will need to add the rights.
login to mariadb/mysql:


mysql -uroot -p

check if user is added:


SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';

MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';

+----------+------+

| User | Host |

+----------+------+

| librenms | % |

+----------+------+

Now add the root user:


GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'YOUR PASSWORD' WITH GRANT OPTION;

And now flush:


flush privileges;

MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';

+----------+-------------+

| User | Host |

+----------+-------------+

| librenms | % |

| root | % |

+----------+-------------+
If you want to comment: Login or Register