Tag Archives: Databases

Rename a Database in phpMyAdmin

In this article, we will show you how to rename a database using phpMyAdmin.

A free and open-source program for managing MySQL databases is called phpMyAdmin. It is one of the most widely used web-based MySQL management tools for hosting companies. Users can communicate with their MySQL databases using phpMyAdmin, which is written in PHP.

Quick Steps

Step 1: Go to cPanel > Databases > phpMyAdmin
Step 2: Select the database you wish to rename from the left-hand column.
Step 3:
Click on the Operations tab.
Step 4:
Under the field “Rename database to:” enter the new database name.
Step 5:
Click the Go button.
Step 6:
Click OK to proceed.
Step 7:
Once the operation is complete, click OK when asked if you want to reload the database.

Note: Keep in mind that when you change the name of a database, you will have to reconfigure user permissions to continue referencing this database.

Renaming the Database

Go to cPanel > Databases and click on phpMyAdmin.

Renaming the Database

Renaming the Database

phpMyAdmin will open up in a new tab. Select the database you wish to rename from the left-hand column and then click on Operations.

phpMyAdmin Operations

phpMyAdmin Operations

Select a database in phpMyAdmin.

Enter the new database name in the field “Rename database to:” and click Go. 

Renaming the database

Renaming the database

Renaming the database.

Click OK to proceed when it asks if you want to create the new database and drop the old database.

create the new database and drop the old database

Rename the database in phpMyAdmin.

That’s it! The database has been renamed to “test” as shown below, 

PHPMyAdmin Structure

PHPMyAdmin Structure

Databases list in phpMyAdmin.

Re-configuring User Permissions.

The user permissions will need to be updated because the database has been given a new name. Click on MySQL Databases on the main cPanel screen.

The Add User To Database part can be found by scrolling down the page. Choose the renamed database and the database user who was formerly linked to this database from the list. Next, select the Add button.

Add User to Database

Add User to Database

Reconfigure permissions for the database user in cPanel.

On the Manage User Privileges page, check the box next to All Privileges and click on the Make Changes button.

Manage User Privileges

Manage User Privileges

Conclusion

The database should now have a new name. You may also need to update all the scripts or applications to continue accessing the renamed database.

How to Install MariaDB/MySQL on CentOS 7

In this guide we’ll go through the steps for installing the latest version of MariaDB on CentOS 7.

All Commands – without sudo

yum update -y
echo -e "[mariadb]\nname=MariaDB Repository\nbaseurl=http://yum.mariadb.org/10.3/centos7-amd64\ngpgcheck=1\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" | tee /etc/yum.repos.d/MariaDB.repo
yum install mariadb-server mariadb-client -y
systemctl start mariadb 
systemctl enable mariadb
mysql_secure_installation

All Commands – with sudo

sudo yum update -y
sudo yum install mariadb-server mariadb-client -y
echo -e "[mariadb]\nname=MariaDB Repository\nbaseurl=http://yum.mariadb.org/10.3/centos7-amd64\ngpgcheck=1\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" | sudo tee /etc/yum.repos.d/MariaDB.repo 
sudo systemctl start mariadb 
sudo systemctl enable mariadb
sudo mysql_secure_installation

 

MariaDB is the default database management system in CentOS 7 and is a drop-in replacement for MySQL. It is an opensource relational database that uses the Structured Query Language (SQL) to manage its data. 

Prerequisites

  • A CentOS 7 VPS
  • Sudo access

Update Your System

Log in as a sudo user and then update your system.

yum update -y

Install MariaDB

At the time of writing this article, the latest version of MariaDB is version 10.3. If you want a different version of MariaDB, go to the official MariaDB repositories page and generate a repository file for the specific MariaDB version you require.

To enable the MariaDB repository, create a repository file named MariaDB.repo and add the following content in /etc/yum.repos.d/MariaDB.repo

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Install the MariaDB server and client packages using yum.

yum install mariadb-server mariadb-client -y

Now that MariaDB has installed successfully, run the following command to start and enable the service.

systemctl start mariadb

systemctl enable mariadb

To prevent unauthorized access to your database and remove some dangerous defaults run the following command.

mysql_secure_installation

You will be prompted with an option to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, remove test databases and reload privileges. It is recommended that you answer ‘yes’ to these options to secure the database server.

Verify the Installation

Run the following to test to get info about the installation of MariaDB.

mysqladmin -u root -p version

You’ll see an output similar to what shown below,

mysqladmin Ver 9.1 Distrib 10.3.13-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Server version 10.3.13-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 35 sec

Threads: 7 Questions: 16 Slow queries: 0 Opens: 18 Flush tables: 1 Open tables: 12 Queries per second avg: 0.457

Conclusion

We’ve successfully installed and secured MariaDB on your CentOS 7 server. If you have any questions, please feel free contact our technical support.