Change the MySQL database name and MySQL Database Name

Source: Internet
Author: User

Change the MySQL database name and MySQL Database Name

First, I would like to thank the online comrade who has provided a solution.

Many beginners of MySQL Databases may encounter a problem about renaming. You may think of searching on the internet as soon as possible. In fact, I am in the same mentality as everyone else (haha ).

As far as I know, the statement for changing the TABLE name of the MySQL database is RENAME TABLE old_table_name to new_table_name, maybe you will say that the name of the database is almost the same (if you are using a very early version, you are right, but most of us are using a very new version now. version x)

Let's talk about the two methods.

1. In the default MyISAM storage engine: Disable mysql, change the name of the database folder to be modified in the data directory under the mysql directory to the name of the new folder, and then restart the mysql service, you can.

2. Under the default InnoDB Storage engine: Create a database according to the new name and delete the triggers for all tables in the original database, use rename table [run the rename table db_name.tbname to new_db_name.tbname command] to copy the data table in the original database to the new database, and then create the previously deleted trigger in the table in the new database, create a stored procedure or something.

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.