Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to rename a MySQL database on a Plesk server?
Answer
Note: If the database, which is going to be renamed, belongs to a CMS website (WordPress, Joomla!, Drupal, etc), don't forget to change the database name in the CMS configuration file.
Method 1
This method works for those cases, when a database was not installed along with a CMS via Plesk Applications.
-
In Plesk, go to Domains > example.com > Databases.
-
Under the old database, click Copy > in the opened window, specify a new database name and click OK.
-
Go to Database Users > click on the user of the old database > in the Database field, select the new database from the drop-down list > click OK.
-
Remove the old database.
Method 2
-
In Plesk, go to Tools & Settings > Databases Servers > click on the
button next to MySQL to enter phpMyAdmin.
-
In phpMyAdmin, select a database that is going to be renamed from the list (1) > click Operations (2) > specify a new database name under the Rename database to field (3) > click Go (4) > confirm the operation by clicking OK in the opened window.
-
Specify the new database name in the Plesk database:
5.1. Open the Plesk database in MySQL.
# plesk db
5.2. Find ID of the old database. Replace OLD_NAME with an old database name:
MYSQL_LIN: mysql> select id, name from data_bases where name="OLD_NAME";
+----+----------+
| id | name |
+----+----------+
| ID | OLD_NAME |
+----+----------+5.3. Rename the database using the ID from the step above. Replace NEW_NAME with a new database name:
MYSQL_LIN: mysql> update data_bases set name="NEW_NAME" where id="ID";
Comments
0 comments
Please sign in to leave a comment.