1 頁 (共 1 頁)

當 mysqldump 遇到 Out of memory 之解決方法

文章發表於 : 週五 12月 8日, 2006年 10:21 am
DarkSkyline
說明:
當 MySQL 的資料量太大, 在使用 mysqldump的時後遇到 Out Of Memory 的時後該怎麼辦?

有以下兩種做法:
1. 設定 my.cnf, 設定以下參數, max_allowed_packet=16M 可隨機再調大.
[mysqldump]
quick
max_allowed_packet = 16M

2. 使用 -q (--quick) 的參數, 使用此參數就不會使用到 Memory.

使用範例: mysqldump -q -u root DB_NAME > DB_NAME.sql

原廠的說明如下:
--quick, -q
This option is useful for dumping large tables.
It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out.