How To Install phpMyAdmin on a LEMP server

Updated on January 19, 2021
How To Install phpMyAdmin on a LEMP server

About phpMyAdmin

phpMyAdmin is a free software to work with MySQL on the web—it provides a convenient visual front end to the capabilities of MySQL.


Prior to installing phpMyAdmin, be sure that you have LEMP installed on your VPS. If you do not, you can see how to do that here.

Once you have finished installing LEMP on your virtual private server, you can start on installing phpMyAdmin.

Step One—Install phpMyAdmin

Start off by downloading the program from apt-get.

sudo apt-get install phpmyadmin

During the installation, phpmyadmin will ask you if you want to configure the database with dbconfig. Go ahead and choose yes.

Input MySQL’s database password when prompted and click ok.

When phpmyadmin prompts you to choose a server (either apache or lighttpd) hit tab, and select neither one.

Step Two—Configure phpMyAdmin

You now have phpMyAdmin installed on your server. In order to access it, you need to take one more step.

Create a symbolic link between phpMyAdmin and your site’s directory. If you were using the previous tutorial, it may be still located in the nginx default directory, otherwise link it with the appropriate place:

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www

Restart nginx:

sudo service nginx restart

You should now be able to access phpMyAdmin by going to yourdomain/phpmyadmin. The screen will look like this.

Log in with your MySQL username and password.

By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I had to do: sudo ln -s /usr/share/phpmyadmin/ /var/www/html/

instead of sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www

If you are gettting the 404 in yourdomain.com/phpmyadmin, try

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html

and then

sudo service nginx restart

instead of

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www

(This is because the folder “www” was replaced in the newer versions of Nginx through “html”).

For those who changed root folder and want to access domain.com/phpmyadmin.

Step 1: sudo nano /etc/nginx/sites-available/example.com Step 2: Add below line

location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+.php)$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~* ^/phpmyadmin/(.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } }

Save and exit Step 3: sudo service nginx restart


If you were following the tutorial here: https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04 your wordpress website is in /var/www so instead of

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www


sudo ln -s /usr/share/phpmyadmin/ /var/www

I followed all the steps but when i try to access phpmyadmin it doesn,t show up. What i get is my wordpress home page. =

Any idea?

Thank you.

I followed all the steps but still getting error: 404 Not Found nginx/1.18.0 (Ubuntu)

In step two, since the home directory for NGINX is at /var/www/html/phpmyadmin, that simlink command should be: sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin

Use this is you follow the tutorial and get a 404 error when you try to access phpmyadmin in your browser.

Cheers, Somto


I’m getting a 404 error after using this guide. I have multiple domain set up on Ubuntu using nginx. The only difference was the following command:

sudo ln -s /usr/share/phpmyadmin/ /var/www

There is a phpmyadmin directory within /var/www/. Do I need to add server block possibly? Since I have multiple domains, each of them has a separate configuration file.

Any suggestions?

getting blank screen when going to mydomain.com/phpmyadmin with these errors in browser’s console:

Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING
Uncaught ReferenceError: $ is not defined
Uncaught ReferenceError: PMA_commonParams is not defined

On newer version of Ubuntu the root might be “/usr/share/nginx/html” :

sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html

Restart nginx:

sudo service nginx restart

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel