MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 

How to rename a database with full Innodb Tables?

I want to rename MySQL database.  All tables of my this database are of  InnoDB table type. Is there any command  to rename a database with full Innodb Tables?

Answer No: 54

This can be done by more than one way.  First way, you can try to dump-to-sql the whole DB, then create a new DB and import the sql-dump in the new DB. For this, you may use mysqlhotcopy or mysqldump MySQL utilities.

Second way, you can also use the RENAME TABLE command by creating the new database then use RENAME dbname.table TO newdbname.table. You can list multiple tables like below:

RENAME TABLE current_db.table1 TO other_db.table1,
current_db.table2 TO other_db.table2,
current_db.table3 TO other_db.table3;

Related MySQL FAQs to the Above FAQ

When-should-we-use-innodb-engine When should we use innodb engine?

How-to-create-innodb-table-in-MySQL How to create innodb table in MySQL?

How-to-install-Innodb-Engine How to install Innodb Engine?

How-to-uninstall-Innodb-Engine How to uninstall Innodb Engine?

How-to-take-data-back-up-for-InnoDB-tables-like-copy-paste How to take data back up for InnoDB tables like copy paste?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2023  www.mysqlfaqs.net
All rights reserved.