Before proceeding with the installation, make sure that your server has the software necessary for phpMyAdmin to work correctly: the Apache HTTP server, the MySQL database management system, and the PHP programming language.
Next, start updating the package list. To do this, use the apt utility in the terminal.:
sudo apt update
Next, you need to check the availability of the mbstring module to work correctly with multibyte strings. You can also check with the apt utility.:
sudo apt install php-mbstring
If the module is not installed, the utility will suggest installing it.
To start the installation, run the installer and follow the instructions:
sudo apt install phpmyadmin
Step 1. Select the installed web server. For example, we have apache2 installed in our system, select it. Make sure to confirm the selection with a space bar so that an asterisk appears, and press Enter.

Step 2. Confirm the addition of a special database for phpMyAdmin and press Enter.

Step 3. Manually set the password. Otherwise, it will be generated automatically.

Step 4. Select the connection method between phpMyAdmin and MySQL. The default installer recommends a Unix socket connection, but you can choose any option depending on the specific conditions and requirements of your project.
- The TCP/IP network protocol provides a secure and reliable connection, protecting confidential data and detecting/correcting errors in data transmission. However, this method is slower and requires configuration.
- Connecting via a Unix socket provides faster data transfer and does not require special configuration, but it does not allow you to set up an encrypted connection and does not know how to find and fix errors.

Step 5. Next, select the appropriate plugin for authentication.

Step 6. The installer will ask you to specify the name of the phpMyAdmin database.

Step 7. Next, you need to specify the MySQL username for phpmyadmin.

The number of installation steps may vary depending on your settings.
Finally, activate the mbstring module and restart Apache.:
sudo phpenmod mbstring
sudo systemctl restart apache2
Now you can go to the address in your browser and check the work of phpMyAdmin.:
your server's ip/phpmyadmin/
The login form page should open.
Changing the root authentication type and adding an account
You will not be able to log in to the phpMyAdmin panel as root immediately. This is because it is recommended to use another user with limited privileges for security.
However, if you still need to log in to phpMyAdmin as root, you can change the authentication type to caching_sha2_password using the following steps:
sudo mysql
Using the following command, we will change the authentication type by specifying your password:
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'your pass',
To protect your data, you need to create another account to interact with the database from the phpMyAdmin control panel. let’s do this in the MySQL shell:
sudo mysql
To add an account, insert the command in the MySQL shell:
CREATE USER 'name'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'your pass';
Privileges can be granted to all tables in different databases by entering the following command in the MySQL shell. You can also add, change, or delete account privileges by executing a command in the MySQL shell.:
GRANT ALL PRIVILEGES ON *. * WITH GRANT OPTION to 'name'@'your pass';
Go to phpMyAdmin and enter your new account details. You can now manage account access rights in the Control panel.
Basic Security Settings
Since phpMyAdmin is free and is installed on many MySQL servers, it is especially important to protect your server from the local network and the Internet.
Unnecessary users should be disabled in the MySQL shell.:
DROP USER ‘name’@’localhost’;
Apache allows you to enable additional protection for the phpMyAdmin panel. This is possible thanks to the file.htaccess. You can use it to check when accessing the control panel website.
First, make a change to the phpmyadmin.conf configuration file by adding the AllowOverride All line to the Directory /usr/share/phpmyadmin section:
sudo nano /etc/apache2/conf-available/phpmyadmin.conf
Restart the web server:
sudo systemctl restart apache2
Create a file using the command:
sudo nano /usr/share/phpmyadmin/.htaccess
Add to .htaccess the following lines:
AuthType Basic
AuthName “Restricted Files”
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user
To add users, you need to create another file.htpasswd, which stores account data:
sudo htpasswd -c /etc/phpmyadmin/.htpasswd you_login
where you_login is the account login.
Also, add a new account, run it without -c:
sudo htpasswd /etc/phpmyadmin/. htpasswd you_login
To access the control panel, enter the account information from the file.htpasswd.
