Setup PhPMyadmin Linux

Introduction: While many users may require the functionalities of a database management system like MySQL, they might not feel comfortable interacting with the system solely through the MySQL prompt. Phpmyadmin was created to allow users to interact with MySQL through a web interface. In this guide, we will explore how to install phpmyadmin so that you can securely manage your databases on an Ubuntu 20.04 system.

Prerequisites: To complete this guide, you will need:

A server running Ubuntu 20.04, Debian 10, or 11, with either a root user (preferred) or a non-root user with administrative privileges.
A LAMP (Linux, Apache, MySQL, and PHP) stack installed on your Ubuntu 20.04, Debian 10, or 11 server.

Step 1 - Install MariaDB:

    sudo apt update
    sudo apt install mariadb-server mariadb-client

Step 2 - Install phpmyadmin:

    sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

Choose the following options when prompted to configure your installation:

For server selection, choose apache2. Warning: When the prompt appears, "apache2" is highlighted but not selected. Press SPACE to select Apache; otherwise, the installer won't move the necessary files during installation.

The only remaining task in this tutorial section is to explicitly enable the PHP mbstring extension, which you can do by typing:

    sudo phpenmod mbstring

Then, restart Apache for the changes to take effect:

    sudo systemctl restart apache2

Phpmyadmin is now installed and configured to work with Apache. However, before you can log in and start interacting with your MySQL databases, ensure that your MySQL users have the required privileges to interact with the program.

Step 3 - Create a user for phpmyadmin: To create a new user account in MySQL, follow these steps:

    sudo mysql
    CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON * . * TO 'new_user'@'localhost';
    FLUSH PRIVILEGES;

Step 4 - Adjust the file upload size in php:

    nano /etc/php/7.4/apache2/php.ini

In the php.ini file, search for the upload_max_filesize keyword and update its value with the desired file size for larger files. By default, it is set to a maximum of 2MB. For example, you can set it to 20MB.

Then, search for the post_max_size keyword and update its value to the required maximum, corresponding to the size of the entire content and files. For instance, you can set it to 50MB.

Last updated