My Raspberry Pi 3b running Raspbian Stretch with desktop, Release 2017-09-07.

I want to install the "LAMP" on my Raspberry Pi.

I successfully install apache2 and PHP, and went on to install the mysql-server when the problem appeared.

I got this question for this days.

1. When I used the Official default sources

deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi and use sudo apt-get install mysql-serverto install mysql but the system was installed the "mariadb" as the result. And it don`t ask me the root password.

Then I reset the root password and go on install other software was succeed. But when I use the phpmyadmin or WordPress to control the mysql database. I can`t use the Root and password to login the phpmyadmin or WordPress.

2. When I use the Tsinghua University sources

deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib

and use sudo apt-get install mysql-server to install .The result was different.

The code is back.pi@raspberrypi:~ $ sudo apt-get install mysql-server

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Does anyone know how to solve this problem?


2 Answers 2


I had the same problem with not being asked to enter the root password during installation.

I found the answer here: Raspbian Stretch with MariaDB

Note that even though mysql -u root -p does not work, it works when you put a sudo in front: sudo mysql -u root -p. Do that, and then run the following:

sudo mysql -u root

[mysql] use mysql;
[mysql] update user set plugin='' where User='root';
[mysql] flush privileges;
[mysql] \q

Afterwards, connecting via just mysql -u root -p works fine.


I too have had issues with MySQL so many that I dont use it anymore on the Rpi. A drop in replacement is MariaDB, all your of scripts will work as it uses the same syntax. Also install PHPMyadmin

sudo apt-get install mariadb-server mariadb-client
  • This makes no difference. In fact, mysql-server and mariadb-server is actually the same. When you install mysql-server and then run mysql (client), you will see that you are actually logged on to mariadb anyway. Oct 11, 2017 at 19:56

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.