How to enable the drop database in phpmyadmin

How to install pHpMyAdmin in Ubuntu 20.04

Databases are a central axis in thousands of businesses these days as they enable automated and centralized control of millions of pieces of data, ranging from user IDs to day-to-day sales. These databases can be growing exponentially as the company grows. For this reason, it is important to have software available that is available for this massive growth. The most important pillars of a database system are:

If any of these pillars are not met, our data stored in the database may have serious errors. phpMyAdmin was designed to give us a comprehensive solution for all of these situations. EinWie.com teaches you how to install phpMyAdmin Ubuntu 20.04 and has a robust platform to manage databases.

phpMyAdmin is written in PHP and its main role is to manage MySQL on the web. MySQL is one of the most popular languages, but phpMyAdmin supports hundreds of operations that are performed in both MySQL and MariaDB.
phpmyAdmin tries to simplify the traditional tasks of administrators as much as possible, as they can be carried out directly via a simplified but dynamic interface. Tasks like:
  • Create, edit or delete tables and columns.
  • Make use of relationships, indexes, and more.
  • Manage users and permissions.
Currently, phpMyAdmin is available in 72 languages ​​and supports LTR and RTL languages. Some of its main functions are:
  • MySQL user accounts and permissions can be managed
  • It enables information to be exported in various formats such as CSV, SQL, XML, PDF, ISO / IEC 26300 - OpenDocument Text and Spreadsheet, Word, LATEX
  • Supports MySQL functions
  • This allows you to import CSV and SQL data
  • It allows us to manage multiple servers at the same time
  • Enables a global search to be carried out on a database or on a subset of this database
  • Supports batch queries

We will see how to install phpMyAdmin in Ubuntu 20.04 and manage the databases from there to ensure the best solution for our company. In different sections you will learn how to install Apache PHP MysQl and phpMyAdmin in Ubuntu 20.04.

Contents

1. Install Apache and MySQL on Ubuntu 20.04

We need to install Apache and MySQL in Ubuntu 20.04 to manage both the database and the website. To do this installation we run the following command:

sudo apt install apache2 mysql- server -y

Once this process is complete, we will see:

To install phpMyAdmin we have to resort to third party repositories as phpMyAdmin is not available in the standard Ubuntu repository by default. This repository needs to be added by doing the following:

sudo apt install software-properties-common -y

Now let's add the repository with the following command:

sudo add -apt-repository ppa: ondrej / php

Hit Enter to add it:

Once added, we can install phpMyAdmin with the following command:

sudo apt install phpmyadmin php-mbstring php-gettext -y

We enter the letter “S” to confirm the download and installation of phpMyAdmin in Ubuntu 20.04. During this process, the following message is displayed:

Select Apache with the space bar and click OK to continue. Now you will see the following message regarding the phpMyAdmin database:

We click on OK and now have to confirm the selection:

Select “Yes” and define the password for phpMyAdmin:

We click on Accept and confirm the password:

Then the installation process of phpMyAdmin will be completed:

After that we enable the PHP mbstring extension with the following command:

sudo phpenmod mbstring

We restart Apache with the following command:

sudo systemctl restart apache2

2. Authenticate the phpMyAdmin user in Ubuntu 20.04

By default, phpMyAdmin will automatically create a user who will manage the database, which is called phpmyadmin and whose administrator password was entered during the installation process. For security reasons, it is ideal to create another user who is responsible for managing the databases through the phpMyAdmin web interface.Since we have the MySQL platform installed, the MySQL root user is configured to be through the auth_socket Plugin authenticated. The goal is to change the authentication method from auth_socket to mysql_native_password.

To do this, we log into the MySQL shell with the following command:

sudo mysql

We check the current MySQL user authentication method with the following command in the shell:

SELECT user, authentication string, plugin, host FROM mysql.user;

This result indicates that root is using the auth_socket plug-in for authentication. To authenticate with a password, the following line must be entered:

ALTER USER 'root' @ 'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

We apply the changes with the command:

WASHING PRIVILEGES;

Now let's check the change with the following command:

SELECT user, authentication string, plugin, host FROM mysql.user;

We can see that the authentication method is now “mysql_native_password”.
The next step is to create a user “phpmyadminuser” for the connectivity process with phpMyAdmin. In the MySQL shell we do the following: To log in with the root user and the password we have set:

mysql -u root -p

There we enter the following lines in which the user is created with the password and the corresponding permissions are granted. We leave the shell with the exit command.

CREATE USER 'phpmyadminuser' @ 'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *. * TO 'phpmyadminuser' @ 'localhost' WITH GRANT OPTION;

3. Open phpMyAdmin in Ubuntu 04/20

To do this, we need to know the IP address of Ubuntu 20.04, for this we execute the command “ip add”:

Now let's go to a browser and enter the following:

http: // IP_address / phpmyadmin

We enter the username and password that we created in the MySQL shell:

Or if we want we can enter with the root user and this will be phpMyAdmin's first console in Ubuntu 20.04:

On the lateral side we find all the packages and languages ​​that were installed with their respective versions, on the central side we configure general aspects and on the left lateral side we find the tools that work in the databases.

4. Configure phpMyAdmin security in Ubuntu 20.04

An important security step is to protect the instance of phpMyAdmin with the noise that no unauthorized access occurs. This is possible thanks to the .htaccess authentication and authorization functions integrated in Apache.

We will access the file in the following order:

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

We will see the following:

There we will enable the use of .htaccess file overrides by adding the line “AllowOverride All” like this:

Options SymLinksIfOwnerMatch DirectoryIndex index.php AllowOverride All

We save the changes with the following key combination:

Ctrl + O.

We leave the editor with:

Ctrl + X.

We restart Apache:

sudo systemctl restart apache2

Now let's create a .htaccess file in the phpmyadmin directory in the following way:

sudo nano / usr / share / phpmyadmin / .htaccess

There we will enter the following:

AuthType Basic AuthName "Restricted Files" AuthUserFile / etc / phpmyadmin / .htpasswd Require a valid user

We save the changes made. It's time to create an administrator using the htpasswd utility like this:

sudo htpasswd -c / etc / phpmyadmin / .htpasswd admin

The goal is that when accessing phpMyAdmin via the browser, the following pop-up window opens where you can enter the credentials:

We click on “Login” to access phpMyAdmin:

We will see the phpMyAdmin console like this:

From this point on we can use all the phpMyAdmin options to manage MySQL much more interactively and thus to know how to install Apache PHP MysQl and phpMyAdmin in Ubuntu 20.04.