當 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.


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 kevin0523 的頭像
    kevin0523

    新‧夢想

    kevin0523 發表在 痞客邦 留言(0) 人氣()