Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to export and import database by Navicat

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to export and import Navicat into the database, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Description

Export (backup or transfer to someone else) a database in a mysql database

Export:

Use Navicat to connect to mysql, then select the database you want to export, right-click, select dump SQL file..., name it .sql, and save it locally. As shown below:

Choose to dump the SQL file.

Save to local: database name. sql

Saved successfully

What is in the usersinfo.sql:

/ * Navicat MySQL Data TransferSource Server: localhost_3306Source Server Version: 50508Source Host: localhost:3306Source Database: usersinfoTarget Server Type: MYSQLTarget Server Version: 50508File Encoding: 65001Date: 2018-07-03 15:42:50*/SET FOREIGN_KEY_CHECKS=0 -Table structure for `student`-DROP TABLE IF EXISTS `student` CREATE TABLE `student` (`student number `varchar (20) NOT NULL DEFAULT', `name `varchar (20) DEFAULT NULL, `gender `varchar (20) DEFAULT NULL, `professional `varchar (40) DEFAULT NULL, `grade `varchar (20) DEFAULT NULL, `birth `varchar (255DEFAULT NULL), `course `varchar (255DEFAULT NULL), `grade `double DEFAULT NULL, PRIMARY KEY (`student number `) ENGINE=InnoDB DEFAULT CHARSET=gbk -Records of student-- INSERT INTO `student` VALUES ('B1', 'Xiao Li', 'male', 'computer Science and Technology', 'sophomore', '1996', 'Advanced Mathematics', '500') INSERT INTO `student` VALUES ('H1000', 'Xiaoguo', 'female', 'computer science and technology', 'sophomore', '1999', 'higher mathematics', '100'); INSERT INTO `student` VALUES (' H1234', 'Xiaolan', 'male', 'computer science and technology', 'junior', '1997', 'higher mathematics', '200')

You can see that the above are all sql statements, statements for creating tables, and statements for inserting rows of data into the table. Note that in usersinfo.sql, there is only information about the tables in the original usersinfo database, but there is no information about the database itself, so when we import the sql file later, we need to set up a database named "usersinfo".

Import database

To demonstrate, I will first delete the above database usersinfo:

Now

The usersinfo library is no longer in the database:

Import the backed-up database. Sql

Create a new database with the same name as the database name .sql in Navicat, and select the character set

Create a new database usersinfo with the character set of gbk (the same as the character set of the student table above).

Copy usersinfo.sql file name usersinfo, paste, character set select gbk

Then double-click on the usersinfo database, and the color of the usersinfo database changes (turns green).

Then select usersinfo, right, and select run SQL file

Select. Button to select the usersinfo.sql file you just exported locally. Then select utf-8 for the character set (gbk import is not successful), and then click start to import.

Click start to import.

Navicat does not display the table workaround you just imported

Although prompted that the import was successful, we expanded the database usersinfo and found that there were no tables in it.

Refresh

Right-click on the database usersinfo, and then click Refresh.

If the refresh is not valid, disconnect the connection and then connect.

Some older versions may not work by refreshing.

Solution:

Disconnect

Just reconnect to the database.

Now it shows normally that Navicat has to reconnect to the database after each operation, which should be a bug.

Finally, click on the student table and open the table. You can see that the data has been washed and added to the table, and the backup operation is complete.

Thank you for reading this article carefully. I hope the article "how to export and import Navicat into database" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report