PhpMyAdmin is an open-source, front-end tool used in managing tables and data inside databases. It is a third-party tool developed in 1998 and written in PHP programming language. The main purpose of phpMyAdmin is to support operations of MariaDB and MySQL over the web. Thus, phpMyAdmin provides a flexible way for managing databases and an alternative to using MySql or MariaDB from the terminal environment. This guide will take you through the installation, configurations, and usage of phpMyAdmin on Solus.
The main pre-requisite for this installation is a complete LAMP stack on your Solus system. Use the guide in provided link to install and configure Apache, PHP and MySQL/MariaDB database server.
Features of phpMyAdmin
Some of the top notable phpMyAdmin features are listed below.
- Intuitive web interface: phpMyAdmin has a friendly and easy-to-use UI.
- Supports MySQL features: Creates alters, drops databases and tables, and executes SQL statements.
- Import data from CSV and SQL files.
- Export data in different formats such as CSV, SQL, XML, or PDF.
- Transforms stored data into any format using a set of predefined functions.
- Creates complex queries using Query-by-example (QBE)
Why use phpMyAdmin?
- PhpMyAdmin provides a platform where developers can access a query editing facility to create, update or manipulate various operations on any SQL query. Also, you can copy and paste queries from other systems or import files with queries.
- PhpMyAdmin allows database administrators to fetch results and export the same data to desired file formats.
- PhpMyAdmin is a software tool that enables you to access data from that database on MySQL/MariaDB server through its uncomplicated graphical user interface.
Install phpMyAdmin on Solus Linux
In this section, we will install phpMyAdmin on our Solus system. Find the files compatible with the operating system from phpMyAdmin official website.
On your Solus terminal, download phpMyAdmin using the wget command.
Next, extract the downloaded file.
tar -xvf phpMyAdmin-latest-all-languages.tar.gz
Move the file to the /var/www folder.
sudo mv phpMyAdmin-*/ /var/www/phpMyAdmin
Set user and group permissions.
sudo chown -R httpd:httpd /var/www/phpMyAdmin
Then restart the httpd server.
systemctl restart httpd
Creating PhpMyAdmin User
While installing MariaDB/ MySQL, you will create an account with a user and password. These details are used to access phpMyAdmin. Also, we can add another account following this command:
sudo mysql -u root -p
Inside the Mysql shell, create the phpMyAdmin user, set the password, and exit.
CREATE USER 'userA'@'localhost' IDENTIFIED by 'Tech123'; GRANT ALL PRIVILEGES ON *.* TO 'userA'@'localhost'; FLUSH PRIVILEGES; EXIT;
Access PhpMyAdmin on Solus
To start using phpMyAdmin, go to your browser and search for:
http://<serverip_or_hostname>/phpMyAdmin .Replace the server IP with your system IP address.PhpMyAdmin will open as shown below. Enter the user name and password as you set on MariaDB/MySQL.
Creating Database on PhpMyAdmin
After logging in, from the phpMyAdmin interface, click on the create database button. Simply fill in the name you want for your database then click on create. The database will be created successfully
To create a table, go to the SQL section on phpMyAdmin and specify the datatype parameters. Here is an example.
CREATE TABLE trainers ( id INT NOT NULL PRIMARY KEY, first_name VARCHAR (255) NOT NULL, last_name VARCHAR (255) NOT NULL, role VARCHAR (255) NOT NULL );
You can see the table you have created from the structure tab on PhpMyAdmin.
Create Table Data
Insert data on the table you have created from the SQL tab on phpMyAdmin.
INSERT INTO trainers ( id, first_name, last_name, role ) VALUES (123, 'Mark', 'Davis', 'Supervisor'), (456, 'Mary', 'Ndungu', 'Assistant'), (789, 'Elon', 'Jayden', 'Trainer1'), (101, 'Kate', 'Cooper', 'Trainer2');
Use the INSERT INTO statement on SQL to create rows with data.
Using the SELECT FROM command on the SQL table, you will be able to see the table with the rows you have inserted.
PhpMyAdmin is a tool you will want to use due to the user-friendly interface and other benefits it offers. You can install this outstanding tool by following this guide. With a successful installation and configuration, you can continue to use phpMyAdmin on the Solus system and perform different database operations. In case of any challenges, feel free to leave a comment.
More guides to check out: