当前位置:网站首页>Navicat run SQL file import data incomplete or import failed
Navicat run SQL file import data incomplete or import failed
2022-07-07 13:32:00 【Barren desert】
Preface :
When we want to import data from one database to another
Generally, the required data table is dumped sql file And then it runs again sql file Import into the new database
Do it When there is little data, there is usually no mistake
But if the amount of data is large There are many tables There will be a lack of data tables Or lack of data
Solutions to problems :
Inquire online information to know There are several ways to try to solve
First of all :
Start with the configuration file of the database
Find... On the server MYSQL Install under directory my.ini file Then go and modify Remember to restart
lookup max_allowed_packet attribute
max_allowed_packet=50M
Or make it bigger
second :
from navicat Modify the database storage size It's a little similar to the first one I 2 It's all changed
command :
// View the current max_allowed_packet Size
show global variables like 'max_allowed_packet';
// modify max_allowed_packet Size
set global max_allowed_packet=1024*1024*50;
After the change, check whether the following sizes have changed Change is success
Third :
The code and structure of the imported database and the exported database are different
Modify the table character set synchronization of the database
Fourth :
Change strict mode , Perform the following sql Then import sql file ;
SET sql_mode = '';
SET GLOBAL sql_mode = '';
Be careful :
When used "SET sql_mode=''" when ,mysql Clear the default mode information ,
But there is also a problem , It would be mysql No intrusion detection , Error message ,
This requires programmers to sql Be more careful when operating . You can put it sql Add to sql Execute first in the file
The fifth :
When we import data hold " Run multiple queries in each run " Give it right It will be slower But the data will not conflict Will not let the data be reduced
The sixth :
This method is a little metaphysical The credibility needs to be investigated You can try everyone
Select run in the database sql file No... Is selected in the table function sql file It will be more accurate
The seventh :
Use the command line to import and export
One 、window Environmental Science
A. export .sql
1. Export the entire database mysqldump -u user name -p Database name > Exported file name
mysqldump -u dbuser -p dbname > dbname.sql
2. Export a table mysqldump -u user name -p Database name Table name > Exported file name
mysqldump -u dbuser -p dbname users> dbname_users.sql
3. Export a database structure mysqldump -u dbuser -p -d --add-drop-table dbname >d:/dbname_db.sql
-d No data --add-drop-table At every create Add a... Before the statement drop table
B. Import .sql
Commonly used source command
Get into mysql Database console , Such as mysql -u root -p
mysql>use database
And then use source command , The following parameters are script files ( As used here .sql)mysql>source d:/dbname.sql
Import data into database
mysql -uroot -D Database name
Import data into a table in the database
mysql -uroot -D Database name Table name
Two 、linux Environmental Science
A. export .sql
Export database with mysqldump command ( Be careful mysql Installation path for , The path of this command ):
1、 Export data and table structure :
mysqldump -u user name -p Parameters ( Optional ) Database name >/home/sql/ Database name .sql
mysqldump -u root -p --default-character-set=utf8 db_name>/home/sql/fileName.sql
You will be prompted to enter the password after pressing enter
2、 Export only table structure
mysqldump -u user name -p password -d Database name > Database name .sql
/usr/local/mysql/bin/ mysqldump -uroot -p -d abc > abc.sql
notes :/usr/local/mysql/bin/ —> mysql Of data Catalog
B. Import .sql
1、 First, build an empty database
mysql>create database abc;
2、 Import database
Method 1 :
(1) Select database
mysql>use abc;
(2) Set database encoding
mysql>set names utf8;
(3) Import data ( Be careful sql Path to file )
mysql>source /home/abc/abc.sql;
Method 2 :
mysql -u user name -p Parameters ( Optional ) Database name < Database name .sql
mysql -uabc_f -p--default-character-set=utf8 abc < abc.sql
The eighth :
No use. See the latest navicat12 Functions of the belt
Data transmission and data synchronization Structure synchronization Open the interface and have a look Simpler violence
If none of the above has solved your problem
You can try a simple and violent method If there is not much data to import
You can put sql Open the file directly and go to navicat Directly inside Inquire about -> New query Then input sql
See where the error is reported Then modify it accordingly
When your talent can't support your ambition , You should be quiet to learn ; When you can't control your goals , It's time to sink in and experience . Dreams are not impetuous , It's precipitation and accumulation .
边栏推荐
- 单片机原理期末复习笔记
- Write it down once Net a new energy system thread surge analysis
- 记一次 .NET 某新能源系统 线程疯涨 分析
- Detr introduction
- How to make the new window opened by electorn on the window taskbar
- 【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
- PACP学习笔记三:PCAP方法说明
- Why can basic data types call methods in JS
- [untitled]
- mysql 局域网内访问不到的问题
猜你喜欢
Cloud detection 2020: self attention generation countermeasure network for cloud detection in high-resolution remote sensing images
Introduction and basic use of stored procedures
MySQL error 28 and solution
LIS longest ascending subsequence problem (dynamic programming, greed + dichotomy)
Write it down once Net a new energy system thread surge analysis
centso7 openssl 报错Verify return code: 20 (unable to get local issuer certificate)
存储过程的介绍与基本使用
Talk about pseudo sharing
ESP32构解工程添加组件
xshell连接服务器把密钥登陆改为密码登陆
随机推荐
mysql 局域网内访问不到的问题
10 pictures open the door of CPU cache consistency
RealBasicVSR测试图片、视频
Detr introduction
如何让electorn打开的新窗口在window任务栏上面
数字ic设计——SPI
Shell batch file name (excluding extension) lowercase to uppercase
Ogre入门尝鲜
cmake 学习使用笔记(一)
Pay close attention to the work of safety production and make every effort to ensure the safety of people's lives and property
Vscade editor esp32 header file wavy line does not jump completely solved
Talk about pseudo sharing
【学习笔记】zkw 线段树
靠卖概念上市,认养一头牛能走多远?
About how appium closes apps (resolved)
ESP32构解工程添加组件
Unity build error: the name "editorutility" does not exist in the current context
clion mingw64中文乱码
Simple and easy-to-use code specification
QQ medicine, Tencent ticket