- Plesk for Linux
- Plesk for Windows
How to rename a MySQL database in Plesk for Linux?
Note: If a database, which is going to be renamed, belongs to a website based on CMS (WordPress, Joomla!, Drupal, etc.), change the database name in the CMS configuration file.
This method works for those cases when a database was not installed along with a CMS via Plesk Applications.
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.
Go to Tools & Settings > Databases Servers > click on the button next to MySQL/MariaDB to enter phpMyAdmin.
In phpMyAdmin, select a database that is going to be renamed from the database 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.
Now select the 'psa' database from the database list and click SQL.
In the "Run SQL query/queries" field, input this command and click Go to find the ID of the old database. Replace OLD_NAME with the old database name:
PLESK_INFO: select id, name from data_bases where name='OLD_NAME'
The output will look like:
Click on the SQL tab again and run the following command to rename the database using the ID from the step above. Replace NEW_NAME with the new database name:
PLESK_INFO: update data_bases set name='NEW_NAME' where id='ID'
Please sign in to leave a comment.