Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Change schema name in MYSQL database?

Generally I dump the database and import again it with a new name. This is not an option for very big databases. Apparently
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;
does not good things, exist only in a handful of versions, and is not good idea overall.

This needs to work with InnoDB, which stores things very differently than MyISAM.
by

2 Answers

Kajalsi45d
Use these some easy instructions:
mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql

Or on the other hand to decrease I/O utilize the following:
mysqladmin -u username -p create newdatabase
mysqldump -u username -v olddatabase -p | mysql -u username -p -D newdatabase
Shahlar1vxp
The code for changing scheme name in the MYSQL database is as follows-
mysqladmin create new_db_name
mysqldump db_name | mysql new_db_name

You need to first export the database to file and then import it again in the workbench you may specify the name of the db there. Then in the workbench, gpo to the server tab and then select 'data export'.

Login / Signup to Answer the Question.