Home > Database > navicat > How to modify the database name in navicat

How to modify the database name in navicat

angryTom
Release: 2019-08-09 15:46:33
Original
16808 people have browsed it

How to modify the database name in navicat

There is a database named A that needs to be modified to B. In Navicat, you cannot press F2 to modify the name of the database. We must create a new library and name it B. The following 4 ways can achieve your goals. If there are remote tables and permission settings in the database, the fourth method is recommended.

Recommended tutorial: navicat graphic tutorial

## 1. If the tables and settings in database A It's relatively simple, just copy all the tables in database A and paste them into database B.

 2. Right-click on database A -> Dump SQL file -> Structure and data; Right-click on database B -> Run SQL file.

Execution speed: slowest.

 3. Select the menu bar: Tools -> Data Transfer (source database is A, target database is B) -> Start. After the transfer is completed, refresh database B.

If there is a remote table in database A, the operation will report an error. The error message is:

  [Err] [Dtf] 1432 - server name: '' doesn't exist!
Copy after login

Therefore, you need to first copy the DDL statements of all remote tables in the database to one txt file, and then delete all remote tables in the database. Perform this operation again. Finally, execute all DDL statements saved in the txt file on library B. Implementation principle: copy and paste. Execution speed: medium.

4. Rename all tables in database A. The two libraries must be on the same server. (Recommended)

Execute the following SQL statement, and the query result is a collection of sql scripts to rename the table:

select CONCAT('RENAME TABLE ',TABLE_SCHEMA,'.',TABLE_NAME,' to ', 'B.',TABLE_NAME,';') 
from information_schema.`TABLES` where TABLE_SCHEMA = 'A';
Copy after login

Copy all the result rows and use them as sql script execution. Execution speed: fastest.

Note: In order to prevent unknown accidents from happening, please back up your database before performing the operation! !

The above is the detailed content of How to modify the database name in navicat. 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