Plesk

How to rename a MySQL/MariaDB database in Plesk for Linux

Question

How to rename a MySQL/MariaDB database in Plesk for Linux?

Answer

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.

 

Renaming a database in Plesk

 

This method works for those cases when a database was not installed along with a CMS via Plesk Applications.

  1. Log in to Plesk.

  2. Go to Domains > example.com > Databases.

  3. Under the old database, click Copy > in the opened window, specify a new database name and click OK.

  4. 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.

  5. Remove the old database.

 

Renaming a database using phpMyAdmin

 

  1. Log in to Plesk.

  2. Go to Tools & Settings > Databases Servers > click on the button next to MySQL/MariaDB to enter phpMyAdmin.

  3. 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.

  4. Now select the 'psa' database from the database list and click SQL.

  5. 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:

    select id, name from data_bases where name='OLD_NAME'

    The output will look like:

  6. 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:

    update data_bases set name='NEW_NAME' where id='ID'

 

Exit mobile version