cPanel does not provide a direct option to rename a database through its interface. However, you can achieve this by following a workaround that involves creating a new database, importing the data, and updating any necessary configurations.
Step 1: Log in to cPanel
- Open your web browser and go to your cPanel login page (e.g.,
https://yourdomain.com:2083
). - Enter your username and password, then click Log in.
Step 2: Backup the Existing Database
- Go to the Databases section in cPanel.
- Click on phpMyAdmin.
- In the left panel, select the database you want to rename.
- Click Export in the top menu.
- Choose Quick export method and format as SQL.
- Click Go to download the database backup.
Step 3: Create a New Database
- Return to the cPanel dashboard and navigate to the Databases section.
- Click on MySQL Databases.
- Under the Create New Database section, enter the desired name for the new database.
- Click Create Database.
Step 4: Create or Assign a Database User
- In the MySQL Databases section, scroll to the Add New User section.
- Create a new database user (or use an existing one).
- Assign the user to the newly created database:
- Under Add User to Database, select the user and the new database.
- Click Add and assign All Privileges.
Step 5: Import Data into the New Database
- Go back to phpMyAdmin in the Databases section of cPanel.
- Select the new database from the left panel.
- Click Import in the top menu.
- Choose the previously exported
.sql
file and click Go to import the data into the new database.
Step 6: Update Configuration Files
If your website or application uses this database, update the database credentials in its configuration files. For example:
- Open the wp-config.php file (for WordPress) or the relevant configuration file for your CMS/application using the File Manager or an FTP client.
- Update the following:
- Database Name: Replace the old database name with the new one.
- Database User: Update the username if it was changed.
- Database Password: Update the password if it was changed.
Step 7: Test Your Website or Application
- Load your website or application to ensure it connects to the new database.
- Verify that all functionality is working as expected.
Step 8: Delete the Old Database
- Once you confirm that everything is working correctly, return to the MySQL Databases section in cPanel.
- Under the Current Databases section, locate the old database.
- Click Delete to remove the old database.
Tips for Renaming a Database
- Backup Everything: Always create a full database backup before starting.
- Double-Check Credentials: Ensure all configuration files point to the new database.
- Test Thoroughly: After importing the data and updating settings, test your website or application to confirm smooth operation.
By following these steps, you can effectively rename a database in cPanel while ensuring minimal downtime and maintaining functionality.