Installing phpMyAdmin for Easy MySQL Administration [A How-To Guide]

Written by Bairesdev | Published 2020/05/19
Tech Story Tags: php | mysql | java | java-development | latest-tech-stories | good-company | how-to-install-phpmyadmin | mysql-administration-tips

TLDR PHPMyAdmin was written in PHP and was intended to be used over the web. Using this graphical tool can make your database management life considerably easier. The PHP tool is included in the standard repositories and is easy to install on Ubuntu Server 18.04. You must also set a strong, unique password for the database admin user that is created during the installation. The easiest way to install is to secure the database with the command: apt-get install lamp-server^ -y -y.via the TL;DR App

For any database administrator, being able to employ tools that make the job a bit easier can be the difference between getting everything done by the end of the day and struggling to meet deadlines.
Although every database admin should be comfortable with the command line tools offered by their database of choice, it doesn’t mean they are locked into those command prompts. So when you can employ a GUI tool, it means working with a bit more efficiency and reliability.
For MySQL and MariaDB admins, one such GUI tool is phpMyAdmin. The phpMyAdmin GUI was written in PHP and was intended to be used over the web, so any browser that can reach your network should be able to manage those databases.
The phpMyAdmin feature set includes:
Database/table/column management.
Work with relations, indexes, users, and permissions.
Import data from CSV and SQL.
Export to various formats (such as CSV, SQL, XML, PDF, and spreadsheets).
Administer multiple database servers.
Create graphics from your databases.
Complex query support using Query-by-example (QBE).
Global search.

Anyone who depends on databases, from DB admins to Java developers (such as those employed by BairesDev https://www.bairesdev.com/insights/java-development-services/), would benefit from using phpMyAdmin. Why? Because using this GUI can make your database management life considerably easier.
I want to walk you through the process of installing phpMyAdmin on Ubuntu Server 18.04. 

What you need to install phpMyAdmin

In order to make this work, you’ll need to have an instance of Ubuntu Server 18.04 up and running. You’ll also need to have a user with sudo privileges. Other than that, you’re ready to go.

Installing the LAMP stack

On the off-chance you don’t already have the database server installed, let’s take care of that. In fact, we’re going to install the entire LAMP (Linux Apache MySQL PHP) stack. Log into your server and issue the command:
sudo apt-get install lamp-server^ -y
Once that command completes, make sure to secure the MySQL server with the command:
sudo mysql_secure_installation
Answer the questions, making sure to set a strong, unique password for the MySQL admin user.
When you finish securing the MySQL database server, you’re ready to install phpMyAdmin.

Installing phpMyAdmin

Now that phpMyAdmin is included in the standard repositories, it’s considerably easier to install than it once was. Back at the terminal window, issue the command:
sudo apt-get install phpmyadmin php-mbstring php-gettext -y
During the installation, you must select the web server to be used (Figure 1). Since we just installed a LAMP stack, make sure to highlight apache2 by using your keyboard arrow keys, and then tapping the spacebar to select the option. Once apache2 is selected, tab down to Ok and hit Enter on your keyboard.
Figure 1
Selecting the web browser to be used by phpMyAdmin.
The next interactive section of the installation is to okay the database configuration for phpMyAdmin with dbconfig-common. Yes should already be highlighted (Figure 2), so all you have to do is hit Enter on your keyboard.
Figure 2
Okaying the configuration of your database for phpMyAdmin.
Next, you must provide a password for the phpmyadmin system user (Figure 3). 
Figure 3
Adding a password for phpMyAdmin.
Type and verify the password and the installation will complete.

Creating a phpmyadmin user

The newest iterations of phpMyAdmin don’t want you to log into the system with the root user. To get around that, we need to grant permissions to the phpmyadmin user that is created during the installation. 
To take care of the permissions, go back to the terminal window and log into the MySQL console with the command:
sudo mysql -u root -p
At the MySQL prompt, run the following:
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'@'localhost';
Flush the privileges with the command:
FLUSH PRIVILEGES;
Finally, exit out of the MySQL prompt with the command:
exit

Logging into phpMyAdmin

With the installation complete, it’s now time to log into your phpMyAdmin system. Open a web browser and point it to http://SERVER_IP/phpmyadmin (Where SERVER_IP is the IP address of the phpMyAdmin hosting server). At the login prompt type phpmyadmin for the user and then enter the phpmyadmin user password you created during the phpMyAdmin installation. 
Upon successful authentication, you will find yourself at the phpMyAdmin main window (Figure 4).
Figure 4
The phpMyAdmin main window. 
From the left sidebar, you can click New to create a new database or expand one of your existing databases to begin working with it. 

Conclusion

Congratulations, you now have a web-based GUI for the management and administration of your MySQL databases. With this tool, DB admins and developers who depend on databases for their Java development projects or web server software will have a much easier time getting things done.




Written by Bairesdev | Powerful insights in business, technology, and software development.
Published by HackerNoon on 2020/05/19