Getting root access to new install of PHPMyAdmin

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
Tutorial Difficulty Level    

Immediately after doing a fresh install on LAMP on a barebones Linux Server using Xen Orchestra or otherwise), you should secure your database before going into production.

The command to do this is

mysql_secure_installation

and be sure to create a password for the root user (blank by default in newer MySQL versions).

Now, open your web browser and login to the server IP address followed by /phpmyadmin eg. http://100.10.1.123/phpmyadmin

Still can’t login? No prob. You should be able to login at the command line, like so:

mysql -uroot -p

Give your root password and then execute the following at the mysql prompt:

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

Now do

service mysql restart

and you should now be able to login to PHPMyAdmin as the root user. What you should NOW do is create a user (and database) for use with your application eg. WordPress. Never use the root user for your web application!