Here we will know How Do I quickly Rename A MySQL Database where we know we can not rename the existing database but we can put the whole data in the new database and we can put the name of the new database as per our choice, Which indirectly renaming the database.
Steps To Rename The Database
we can rename the database in different ways where we do not change the name of the expected database but create a new database of the name of our choice and then transfer the data from one database to another database and drop the old database that is how we can rename the existing database even without the use of any operations.
Let’s follow the steps to rename the database.
Connect to the server of Mysql using the account you have and enter a password. For example, look at the code below.
mysql -u root -p
here root is the name of user and now we can access the database.
Switch to the old database which we want to rename to do so follow the example given below.
Here we are going to use the database old_database_name which already exists in the database and is now loaded.
Now we need to create a new database of names of our choice that we want for example look at below.
CREATE DATABASE new_database_name;
Here we created a new database of name new_database_name which we want the name of our database.
Now the main part comes to execute which is to export the data of the old database into new database by simply following the code written below.
mysqldump old_database_name > old_database_name.sql mysql new_database_name < old_database_name.sql
now we had already copied or exported the data of the old database to the new database. Now we did our job as we have the new database of names that we want and the data of the old database that we need.
It is done by importing the data into the new database.
Now we have to drop the old database as it is using the space without any use so let’s drop it by simply applying the drop command.
DROP DATABASE old_database_name;
It will drop the old database.
To learn more about Database | How Do I quickly Rename A MySQL Database at Renaming the database in MySQL.
And to learn more about MySQL Visit MySQL Problems And Tutorials.