The first thing to understand is that in previous versions of MySql, you could just use root and the password you set in your configuration of phpMyAdmin. The process has changed and you now use sudo to access MySql/MariaDB on your Raspberry Pi or any current Debian/SQL versions as I understand it.

Creating A phpMyAdmin “root” User

It’s pretty straight forward, create a user that has privileges like root. To launch MySql or MariaDB type the following in terminal. You will be prompted for your password.

sudo mysql

You will now see your DB prompt.

MariaDB [(none)]>

Type the following while changing “chosen_password” to a password you will use to login to phpMyAdmin. This will create a user called phpmyadmin.

CREATE USER 'phpmyadmin'@'%' IDENTIFIED BY 'chosen_password';

Now we grant full access privileges to phpmyadmin.

GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost' WITH GRANT OPTION;

Or if you need to allow remote connections.


Next you just need to flush privileges.


You can now type exit or hit ctrl > D to quit and launch phpMyAdmin. Use the username phpmyadmin and your password you just set.

Updating The phpMyAdmin Configuration

Finally, you will need to let phpMyAdmin Know about your user. Run the following to edit the file.

sudo nano /etc/dbconfig-common/phpmyadmin.conf

You will need to locate the following and update the user and password to match what we set above.

# dbc_dbuser: database user
# the name of the user who we will use to connect to the database.

# dbc_dbpass: database user password
# the password to use with the above username when connecting
# to a database, if one is required

Restart Apache


sudo service apache2 restart


It’s pretty straight forward and apparently it’s more secure and I’m always happy to have more security.You should be able to see all of your DB’s and manage everything with your new user. Let me know if you have any questions in the comments below.


Article Categories:

Web developer and former photographer by trade...gamer and all around tech enthusiast in his free time. Christoph started sdatic.com as a way to organize his ideas, research, notes and interests. He also found it enjoyable to connect and share with others who parallel his interests. Everything you see here is a resource that he found useful or interesting and he hopes that you will too.

Leave a Reply

Your email address will not be published. Required fields are marked *