To change the name of your database, you must create a new database and import the new one into it. This involves the following steps:
- Backup your old database
- Create a new database with the new name
- Import your old database file into the new database
- Adjust your website's configuration file
This article walks you through these steps.
Step 1 — Backup your old database
First, you need to backup your old database. There are a few ways you can do this:
- Backing up your entire account in the panel
- Exporting your database using phpMyAdmin
- Exporting your database using SSH
View the following article for instructions on how to proceed with any of these options:
This will back up your database into a file ending with .sql.
Step 2 — Create a new database in the panel
Next, you'll need to create a new database with the new name. View the following article for instructions on how to create this database in your panel:
Step 3 — Importing your database
At this point, you have backed up your old database into a file ending with .sql and a new database has been created. You can now import your .sql file into the new database. This can be done using either phpMyAdmin, or SSH. Choose one of the options below.
Importing with phpMyAdmin
If your SQL backup file is under 64 MB in size, it can be imported into your new database via phpMyAdmin. View the following article to import a backed up database through phpMyAdmin:
Importing using SSH
If it's 64 MB or more, (or if you encounter a timeout while importing) the only other option is to import it from the command line via SSH.
Step 4 — Adjusting your website's configuration file
The final step is to update your website's configuration file. Every website that connects to a database has a config file. This config file stores the following database credentials which allows you to connect.
- Database username
- Database username password
- Database hostname
- Database name
If any of those are incorrect, your site cannot connect to the database. Standard config files for popular software are shown below:
|Software||Config file name||Config file location|
|Joomla||configuration.php||In the site's main directory|
|MediaWiki||Localsettings.php||In the site's main directory|
|phpBB||config.php||In the site's main directory|
|WordPress||wp-config.php||In the site's main directory|
You created all of these credentials while creating the new database in step#2 above. After updating your config file with these new credentials, your site will connect to the new database.