Once day you want to rename your database in MySQL for whatever reason. How can you do this idea?
From phpMyAdmin, we often rename a database by applying the following steps:
- Select database on the left side bar/tree or in Databases tab.
- Click on Operations tab.
- Type a new name for the database in the text box along with the label Rename database to,
- Click Go button to process the operation.
See the inserted image as below for your reference.
via MySQL Command Line
- Export structure and data of the database which is going to rename.
mysqldump -u a_given_username -p the_database > dbexport.sql
- Log in to your MySQL Server from a terminal.
mysql -u a_given_username -p
- Create a fresh database
CREATE DATABASE new_database;
- Import structure and data to the newly created database.
mysql -u a_given_username -p new_database < dbexport.sql
- Delete the old database
DROP DATABASE the_database;