mysql匯入資料方法和報錯解決

來源:互聯網
上載者:User

標籤:ar   使用   sp   檔案   資料   div   on   art   amp   

mysql -u root -p databasename < db.sql

 

資料庫匯入資料時,MySQL收到下面異常:ERROR 1153 (08S01): Got a packet bigger than ‘max_allowed_packet‘ bytes。

這是因為沒有調整mysql的預設配置,預設最大隻能處理16M的檔案,而我要匯入的偽造資料有50M的一個SQL。

於是調整設定檔: /etc/my.cnf

修改mysql的最大允許包大小
在[mysqld]部分(不在這部分沒用)添加一句:
max_allowed_packet=50M
重啟mysql服務就可以了。

重啟命令如下:

一、啟動方式
1、使用 service 啟動:service mysqld start
2、使用 mysqld 指令碼啟動:/etc/inint.d/mysqld start
3、使用 safe_mysqld 啟動:safe_mysqld&
二、停止
1、使用 service 啟動:service mysqld stop
2、使用 mysqld 指令碼啟動:/etc/inint.d/mysqld stop
3、mysqladmin shutdown
三、重啟
1、使用 service 啟動:service mysqld restart
2、使用 mysqld  指令碼啟動:/etc/inint.d/mysqld restart

mysql匯入資料方法和報錯解決

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.