Home > Database > Mysql Tutorial > body text

How to change the database name in mysql?

藏色散人
Release: 2020-09-19 13:45:35
Original
28932 people have browsed it

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
Copy after login

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:

How to change the database name in mysql?

4. Mysqldump exports the data and then imports it

The code is as follows:

How to change the database name in mysql?

5. Use shell script to rename all tables

The code is as follows :

How to change the database name in mysql?

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template