Setting Up phpMyAdmin and Creating a MySQL User on CentOS 7

2023-09-28 17:56:35
Performance-Optimized Fast Internet Integrations - POFII

Introduction

phpMyAdmin is a free and open-source tool written in PHP intended to handle the administration of MySQL or MariaDB with the use of a web browser. In this guide, we'll show you how to install phpMyAdmin and create a MySQL user on a CentOS 7 system running MySQL 8.0.

Prerequisites

Before starting, you should have a CentOS 7 server with MySQL 8.0 installed and a non-root user with sudo privileges.

Installation of phpMyAdmin

1. Install EPEL Repository

The EPEL repository contains the phpMyAdmin package. Install it using the following command:

$ sudo yum install epel-release -y

2. Install phpMyAdmin

Once the EPEL repository is enabled, install phpMyAdmin:

$ sudo yum install phpmyadmin -y

Creating a MySQL User

1. Access MySQL

Access the MySQL shell with the following command:

$ mysql -u root -p

2. Create a New User

Create a new user 'newuser' with password 'password' by running:

mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

3. Grant Permissions

Give 'newuser' all privileges for the 'database' database:

mysql> GRANT ALL PRIVILEGES ON database.* TO 'newuser'@'localhost';
mysql> FLUSH PRIVILEGES;

Conclusion

You've successfully installed phpMyAdmin and created a new MySQL user on your CentOS 7 system running MySQL 8.0. Now you can manage your MySQL databases through a user-friendly web interface.

64

Was this answer helpful?