I am following this guide, How to set up a web server on the Raspberry Pi. I am using a Pi 400 so I skipped step 1.

Step 2 involved running:

sudo apt install nginx

which was successful. Now if I re-run the command I get:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nginx is already the newest version (1.18.0-6.1+deb11u3).
The following packages were automatically installed and are no longer required:
  libbasicusageenvironment1 libfuse2 libgroupsock8 liblivemedia77
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 275 not upgraded.

In step 3 I encountered a problem:

First I ran

sudo apt-get install mysql-server

which returned

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:

E: Package 'mysql-server' has no installation candidate

I tried following some online guides but all of them fail.

What is the solution?

2 Answers 2


Use apt-cache to look for likely candidates.

apt-cache search mysql-server
mariadb-server-10.5 - MariaDB database server binaries
mariadb-server-core-10.5 - MariaDB database core server files
default-mysql-server - MySQL database server binaries and system database setup (metapackage)
default-mysql-server-core - MySQL database server binaries (metapackage)

So try

sudo apt install default-mysql-server


MariaDB has replaced MySQL and it is better. You can use the above mentioned

sudo apt install default-mysql-server

command to install MySQL but if you want to go with MariaDB then use the command

sudo apt install mariadb-server mariadb-client -y 

for that. Hope it helps.

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.