• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install phpMyAdmin with Nginx on Ubuntu 18.04

Written by Admin, Updated On August 15, 2019
mariadb, mysql, nginx, php, phpmyadmin, ubuntu
How to Install phpMyAdmin with Nginx on Ubuntu 18.04

phpMyAdmin is a free and web interface based database management tool for managing MySQL and MariaDB. You can manage MySQL databases, user accounts and privileges, import and export data and much more using phpmyadmin interface. In this tutorial, we have described how to install phpMyAdmin with Nginx on Ubuntu 18.04 system.

Prerequisites#

  • You must logged in on Ubuntu server as non-root user account with sudo privileges.
  • Ensure that LEMP (Linux, Nginx, MySQL and PHP) stack is installed on your Ubuntu machine.

We strongly recommend to access your phpMyAdmin installation over HTTPS connections. So it will prevent from unecessary attacks to phpmyadmin. If your domain is not secure with an SSL/TLS certificate, you can follow this guide to Secure Nginx with Let’s Encrypt on Ubuntu.

Installing phpMyAdmin with Nginx on Ubuntu#

At first, to start installation you need to update Ubuntu package index and upgrade system by using the following command:

sudo apt update
sudo apt upgrade

Now, install the phpMyAdmin package from the default Ubuntu repositories with the below command:

sudo apt install phpmyadmin

It will prompt you for few configuration options. At first, it will ask to choose web server as following screenshot. There is no option for Nginx so press Tab and click OK button.

phpmyadmin install nginx

Next, you will be ask to use dbconfig-common to configure the database for phpMyAdmin. Select Yes and hit Enter key to continue.

Configuration

Now enter password for phpMyAdmin to register with the database, select OK and press Enter.

set password

Again, you will be prompted to confirm the password by entering same password and hit on OK button.

Confirm Password phpMyAdmin

That’s all! phpMyAdmin is installed on your Ubuntu server.

After that we will create a symbolic link to access phpMyAdmin interface from installation files. We are linking it to our document root directory by typing:

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

Creating MySQL User and Set Privileges#

In Ubuntu systems, the root MySQL user is using the auth_socket plugin by default to authenticate. It means that you can’t authenticate as a root by providing a password. This will increase some greater security and usability in many cases, but it can also complicate when you need to allow an external program like phpMyAdmin.

In order to log in to phpMyAdmin as your root MySQL user, you will need to switch its authentication method from auth_socket to mysql_native_password. It will not be good to change authentication method for the MySQL root user. Since phpMyAdmin requires users to authenticate with a password, so instead of changing authentication method we will create a new administrative MySQL account in order to access the interface. This user will have the same privileges as the root user and will be set to use the mysql_native_password authentication method.

Now, we will use that user to login to phpMyAdmin and do further administrative tasks on our MySQL or MariaDB server.

You can login by below command:

sudo mysql

Next, create a new administrative user with strong password and grant appropriate permissions by typing:

mysql> CREATE USER 'newadmin'@'localhost' IDENTIFIED BY 'STRONG-PASSWORD';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'newadmin'@'localhost' WITH GRANT OPTION;

Accessing phpMyAdmin#

To access the phpMyAdmin interface open web browser and type your server’s public IP address or domain name followed by /phpmyadmin:

https://IP_ADDRESS_OR_YOUR_DOMAIN/phpmyadmin
phpMyAdmin Login page

Enter the administrative account username and password which you created on previous step and hit on Go button.

After successful log in, you’ll see the phpMyAdmin user interface, which will look something like this:

phpmyadmin dashboard nginx

Conclusion#

Finally, you have successfully installed phpMyAdmin with Nginx on Ubuntu 18.04 system. If you have any question feel free to leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install LEMP Stack on CentOS 7
Next Article   Basic Cat Command Examples in Linux

Related Posts

  • How to Install WordPress with Nginx on Debian 11

    How to Install WordPress with Nginx on Debian 11

    March 22, 2023
  • How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 22.04

    How to Install LAMP on Ubuntu 22.04

    March 20, 2023
  • How to Install LEMP Stack on Ubuntu 22.04

    How to Install LEMP Stack on Ubuntu 22.04

    March 18, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install PHP 8.2 on Debian 11
    How to Install PHP 8.2 on Debian 11 Linux February 24, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook