For the last 6 hours I have been trying to install MariaDB on my Raspberry Pi Zero. I am using the latest Raspbian Stretch. The problem is that the configuration menu for MariaDB doesn't show up during installation (which I believe it should) and it doesn't ask me to set the root password. After installation I cannot login to the MariaDB server with mysql using any credentials, but if I run mysql with root priviliges (sudo mysql) it lets me in without any form of authentication. I tried running mysql_secure_installation after install, but it didn't help. By the way I am trying to install phpMyAdmin.

EDIT: I ended up using Raspbian Jessie, and the configuration dialog popped up as it should, and I could configure the password, and everything worked perfectly fine.

I am (and probably others too) still looking for a solution to this though. I also noticed that on Stretch the debian-sys-maint user wasn't created either, and /etc/mysql/debian.cnf was containing a bad login (user root with no pass).

2 Answers 2


I am running Apache, PHP, MyAdmin and MariaDB on a fresh install of Raspbian Stretch Lite using this sequence, and it works perfectly.

  1. Update

    sudo apt-get update && sudo apt-get upgrade

  2. install mariadb server and client

    sudo apt-get install mariadb-server mariadb-client

  3. install apache and php

    sudo apt-get install apache2 php5 libapache2-mod-php5

  4. install phpmyadmin

    sudo apt-get install phpmyadmin

  5. fix the msqli missing extension

    sudo apt-get install php5-mysqlnd

  6. setup password and secure setup

    sudo mysql_secure_installation

Finished, reboot.

Now if you still get a login/password error then you need to disable Mysql from trying to authenticate root using plugin, and not password.

sudo mysql -u root

[mysql] use mysql;
[mysql] update user set plugin='' where User='root';
[mysql] flush privileges;
[mysql] \q
  • Thanks so much for this answer. The last info block about the plugin actually solved my problem I had with the login without sudo. Commented Oct 11, 2017 at 5:13
  • I'm sorry I didn't have time to test this whole thing earlier. The project is now back on table. With your help I was able to get everything working. I'm using PHP 7.0. This is how I did it: sudo apt-get install mariadb-server mariadb-client then set plugin via sudo (last info block), sudo apt-get install apache2, sudo apt-get install php7.0 libapache2-mod-php7.0, sudo apt-get install php7.0-mysql, sudo apt-get install phpmyadmin, sudo mysql_secure_installation I did this on the latest Raspbian Lite (2017-11-29) Commented Dec 22, 2017 at 16:32

I just got my Raspberry Pi 3 and I've had problems running phpMyAdmin. I've started from scratch a couple of times, and this time I got it finally running. I did the usual steps as suggested by Dr. Rabbit above.

Then, I edited Apache 2's configuration file: sudo nano /etc/apache2/apache2.conf

And included a line: /etc/phpmyadmin/apache.conf

And finally reloaded the web server: sudo /etc/init.d/apache2 reload

I'm a complete Linux noob, and this was absolute trial and error, but it seems to be working. Strangely.. I got the idea for this from Ubuntu guides (e.g. https://help.ubuntu.com/community/phpMyAdmin )

  • It's not strange at all. While GNU/Linux (a more formal label) distributions are independent, they are 99% built from the same basic pieces, and most of the differences are fairly trivial. So generally speaking the documentation produced by one distro is often 100% applicable to another. In addition, there are two main streams, Debian derived distros, and Fedora derived distros. Raspbian and Ubuntu are the former. I find some of the best linux user documentation is produced by Arch, although I've almost never used the distro itself.
    – goldilocks
    Commented Oct 6, 2017 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.