Can I change the name of a MySQL database?

The name of a MySQL database consists of a prefix, which is your cPanel username, followed by a "_" sign and the actual database name.

 

For example, if your cPanel username is user and you create a database  db, the database name will be user_db.

 

Thus, if you wish to change the whole name of a database, two changes should be made - the cPanel username and the database name.

 

In order for a cPanel username to be changed, we have to terminate the account and re-create it anew with the new username. This means you will lose all the data stored on the hosting account, like files, email addresses, MySQL databases, forwarders, etc.

 

This is why it is not recommended to change your username. However, you can easily change the database name suffix by simply creating a new database with the new name and importing the old database in it.

 

In other words, if you wish to rename the database user_db to user_whn, you should first create the new database, then import the old database in it and finally add the user to the new database.

  • 29 Users Found This Useful
Was this answer helpful?

Related Articles

What type of databases do you support? PGSQL and MySQL?

All our servers support MySQL and PostgreSQL databases. Also with any of our hosting packages...

How to repair a MySQL database?

In this article we will show you two ways to repair a MySQL database.  1) Through...

How to optimize a MySQL database using phpMyAdmin?

It is always a good idea to keep your databases' tables optimized. Fortunately, making this...

How to change the database engine of a MySQL database table?

In this article we will show you how to change the database engine of a MySQL table. Let's...

I get an error 'ACCESS DENIED CREATE DATABASE db_name' when I try to import a database

In order to solve this issue follow these steps: Open the MySQL dump with a text editor on...