Home >Database >Mysql Tutorial >How to change the database name in mysql?
The method to modify the MySQL database name is as follows:
1. Statement modification method:
RENAME DATABASE db_name TO new_db_name
This syntax was added in mysql 5.1.7 and removed in 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 the data and then imports it
The code is as follows:
5. Use shell script to rename all tables
The code is as follows :
Related learning recommendations: mysql database
##
The above is the detailed content of How to change the database name in mysql?. For more information, please follow other related articles on the PHP Chinese website!