sql 檔案過大。導致資料庫匯入失敗

2021-09-28 20:51:41 字數 516 閱讀 1589

--  設定 max_allowed_packet = 20m

set global max_allowed_packet = 2*1024*1024*10

mysql max_allowed_packet 設定過小導致記錄寫入失敗

mysql根據配置檔案會限制server接受的資料報大小。

有時候大的插入和更新會受max_allowed_packet 引數限制,導致寫入或者更新失敗。

檢視目前配置

show variables like '%max_allowed_packet%';

顯示的結果為:

+--------------------+---------+

| variable_name      | value   |

| max_allowed_packet | 1048576 |

+--------------------+---------+  

以上說明目前的配置是:1m

————————————————

SQL 檔案匯入資料庫

1 首先通過 xshell 連線資料庫伺服器,執行命令 mysql u root p 命令,按照提示輸入密碼,連線上資料庫 2 在連線終端上執行命令 create database jd model 3 將準備好的資料庫檔案 t user.sql 檔案通過 xftp 工具,上傳至 root 目錄下,...

sql檔案資料匯入資料庫

1.建立createsql.sql檔案,內容 drop table if exists t user create table t user user id int 11 not null auto increment,user name char 30 not null,user password...

將csv檔案匯入sql資料庫

有乙個csv檔案需要匯入到sql資料庫中,其格式為 adb dds sdf adb dds sdf 先在sql資料庫中建乙個表,結構與csv檔案相同 將資料,時間等都定義成nvarchar,否則出現錯誤 然後執行 bulk insert order from c abc.csv with field...