Joke Collection Website - Blessing messages - How to modify MySQL database name

How to modify MySQL database name

Modify the MySQL database name as follows:

1. statement modification method:

Rename the database database name to the new database name.

This syntax was added in mysql 5. 1.7 and deleted in MySQL 5. 1.23.

2. If all tables are of MyISAM type, you can change the name of the folder.

Rename the db_name directory in the data directory to new_db_name.

3. Rename all tables

The code is as follows:

4.mysqldump exports data, and then imports data.

The code is as follows:

5. Rename all tables using a shell script.

The code is as follows: