Linux Tactic

Simplify MySQL Database Management with phpMyAdmin on CentOS+Nginx

Have you ever found yourself in need of managing your MySQL databases but didn’t know where to start? Look no further than phpMyAdmin an open-source tool that simplifies database management by providing a graphical interface for users to interact with their databases.

However, before you can reap the benefits of phpMyAdmin, you must first install and configure it properly. In this article, we will guide you through a step-by-step tutorial on how to install and configure phpMyAdmin on CentOS using Nginx as the webserver.

This tutorial is aimed at individuals who have intermediate-level knowledge of Linux and basic understanding of web servers. Part 1: Installing phpMyAdmin on CentOS

Prerequisites:

Before we can dive into the installation process, there are a few prerequisites that need to be in place.

Here are some of the primary keywords that you should know:

– Nginx: An open-source web server that is known for its high performance, stability, and low resource consumption. – Let’s Encrypt: A free and automated certificate authority that provides SSL/TLS certificates for web servers.

– CentOS 7: A Linux distribution that is known for its stability and reliability. Installation:

Here are the steps to follow to successfully install phpMyAdmin on CentOS:

Step 1: Install EPEL and Dependencies

– EPEL is an extra repository that provides additional packages for CentOS.

To enable EPEL, run the following command:

sudo yum install epel-release

– After enabling EPEL, install the necessary dependencies for phpMyAdmin and Nginx using the following command:

sudo yum install phpMyAdmin nginx php php-mysql php-fpm

Step 2: Install PHP 7

– CentOS 7 comes with PHP 5.x by default, but phpMyAdmin requires PHP 7. To install PHP 7:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

sudo yum install yum-utils

sudo yum-config-manager –enable remi-php72

sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd

Step 3: Set appropriate permissions

– The chgrp command is used to change the group ownership of files.

Set as follows:

sudo chgrp -R nginx /usr/share/phpMyAdmin

Now that phpMyAdmin has been installed successfully, let’s move on to the next part: configuring Nginx and phpMyAdmin. Part 2: Configuring Nginx and phpMyAdmin

Setting up Nginx:

Step 1: Create a new server block

– Every website or application that is hosted on Nginx requires a new server block.

Create a new server block using the command below:

sudo nano /etc/nginx/conf.d/domain.com.conf

– Replace “domain.com” with your domain name. Step 2: Create a symbolic link between the phpMyAdmin directory and the domain document root directory

– A symbolic link is a shortcut to a file or directory located elsewhere.

It helps to create a clear and concise directory structure for the webserver. To create a symbolic link:

sudo ln -s /usr/share/phpMyAdmin /var/www/html/domain.com

– Replace “domain.com” with your own domain name.

Creating a Snippet:

Step 1: Create a new directory for snippets

– Snippets are reusable code blocks that can be inserted into server blocks to save time and reduce errors. To create a new snippets directory:

sudo mkdir /etc/nginx/snippets

Step 2: Create a new configuration file for phpMyAdmin

– Next, create a new configuration file for phpMyAdmin using the following command:

sudo nano /etc/nginx/snippets/phpMyAdmin.conf

Step 3: Add the following configuration snippet to the file:

location /phpmyadmin {

root /var/www/html;

index index.php;

}

location ~ ^/phpmyadmin/(.*.php)$ {

root /var/www/html;

include snippets/fastcgi-php.conf;

fastcgi_pass unix:/run/php-fpm/www.sock;

}

– Save and close the file.

Adding phpMyAdmin to Server Block:

Step 1: Open the server block configuration file

– Open the server block configuration file using the following command:

sudo nano /etc/nginx/conf.d/domain.com.conf

– Replace “domain.com” with your own domain name. Step 2: Add the following code snippet to the configuration file:

include snippets/phpMyAdmin.conf;

– This code includes the phpMyAdmin configuration file we created earlier.

Step 3: Save and close the file. Conclusion:

That’s it! You have successfully installed and configured phpMyAdmin on CentOS using Nginx.

By following the step-by-step instructions, you can easily manage your MySQL databases using the graphical interface provided by phpMyAdmin. The use of subheadings, bullet points, and numbered lists helped to break down the information into bite-sized pieces, making it easier for readers to follow along.

We hope this tutorial was helpful and informative for you. In the previous sections, we covered the installation and configuration of phpMyAdmin on CentOS using Nginx as the webserver.

Now that phpMyAdmin is up and running, we can move on to the next step: accessing and using phpMyAdmin to manage our MySQL databases. Part 3: Accessing phpMyAdmin

Opening phpMyAdmin:

Step 1: Open your preferred web browser

– Open your preferred web browser on your computer.

Step 2: Enter the domain name or public IP address

– In the address bar, enter your domain name or public IP address. Step 3: Add /phpmyadmin to the end of the URL

– After entering the domain name or public IP address, add /phpmyadmin to the end of the URL.

– The final URL should look something like this: http://domain.com/phpmyadmin or http://123.123.123.123/phpmyadmin

– Replace “domain.com” or “123.123.123.123” with your own domain name or public IP address. Step 4: Enter your login credentials

– Once you have accessed the phpMyAdmin login page, enter your username and password to log in.

– By default, you can use the root account to access phpMyAdmin, but it is recommended to create a new user with limited privileges to ensure better security. Using phpMyAdmin:

Now that you have successfully accessed phpMyAdmin, you can start managing your MySQL databases using the graphical interface provided.

Here are some of the basic features and functionalities of phpMyAdmin:

1. Database Management: phpMyAdmin allows you to create, modify, and delete MySQL databases.

You can also view information about your databases, such as the number of tables, size, and collation. 2.

User Management: In addition to managing databases, you can also create, modify, and delete MySQL users using phpMyAdmin. You can assign different levels of privileges to users based on their role and responsibilities.

3. Table Management: phpMyAdmin allows you to manage tables within your databases.

You can create, modify, and delete tables, as well as adjust their structure, add columns, or change attributes. 4.

Query Management: phpMyAdmin also provides a feature to manage queries. You can perform different types of queries, such as SELECT, INSERT, UPDATE, DELETE, etc.

in order to manipulate data within your tables. 5.

Operation Management: Alongside query management, phpMyAdmin also has an operations tab where you can perform tasks such as optimizing tables, repairing tables, and copying tables. Conclusion:

In conclusion, phpMyAdmin is a powerful tool that simplifies database management by providing a graphical interface for users to interact with their MySQL databases.

This article covered the process of installing and configuring phpMyAdmin on CentOS using Nginx as the webserver, as well as how to access and use the tool to manage your databases. By following the step-by-step instructions, you should be able to use phpMyAdmin to create and manage your databases, tables, and users effectively.

In this article, we have explored the process of installing and configuring phpMyAdmin on CentOS using Nginx as the webserver. We also learned how to access and use phpMyAdmin to manage MySQL databases using a graphical interface.

By following the step-by-step instructions, you should be able to create and manage databases, tables, and users effectively. The importance of phpMyAdmin cannot be overstated as it simplifies database management for users of all levels of experience and offers features that make it easy to perform various database-related operations.

Managing MySQL databases has never been easier, thanks to phpMyAdmin’s simplified approach to database management.

Popular Posts