MySQL Database change name

Source: Internet
Author: User

Here first thanks to the comrade who has given the solution on the Internet

There are a lot of MySQL database beginners may encounter a change in the name of the word, maybe everyone will think of the first time to search the Internet, in fact, I am the same as everyone's psychology (hehe).

As far as I know, MySQL database changed the table name of the statement is rename table Old_table_name to New_table_name, perhaps everyone will say that the database name is also similar AH (if you use an early version, then you are right, But most of us now use a very new 5.x version)

Now, let's talk about two specific ways.

1. Under the default MyISAM storage engine: Turn off MySQL, then change the name of the database folder under the data directory in the MySQL directory to the name of the new folder and restart the MySQL service.

2. Under the default InnoDB storage engine: Create a database by the new name, delete the triggers on all the tables in the original library, and use rename table "Use command rename table Db_name.tbname to New_db_name.tbname" Copy the data tables from the original library into the new library, and then set up the previously deleted triggers in the table of the new library, in the setup of the stored procedures.

MySQL Database change name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.