I have 2 VPS and plan to migrate the DB from first to second. The original DB is taking around 15GB of storage and I manage to dump out a 7GB SQL. However, when I imported the SQL to second VPS, it takes up 2x of storage becoming 32GB.
My questions are:
- What might cause my DB from 15GB to become 32GB by just dump+import?
- How can I avoid this?
Below are some further detail:
- Both VPS are not exactly same and so do the MySQL version. The source DB is version 5.5.47. The receiving DB is version 5.7.13.
- The receiving DB is newly install and empty.
- The command I used to dump out SQL is:
mysqldump -u <username> -p --all-databases --add-drop-database --max_allowed_packet=16777216 --single-transaction > full_dump.sql
. The reason I am setting max_allowed_packet is to have the same value compare to receiving DB - Not sure if this is relevant. If I do not specify
single-transaction
in my mysqldump command, it will errormysqldump: Got error: 2006: MySQL server has gone away when using LOCK TABLES
- The source DB storage distribution is different from the receiving DB:
14858M /var/lib/mysql
14483M /var/lib/mysql/ibdata1
365M /var/lib/mysql/wordpress
- This is the receiving DB storage distribution:
31558M /var/lib/mysql
31306M /var/lib/mysql/wordpress
337M /var/lib/mysql/wordpress/wp_wfLeechers.ibd
101M /var/lib/mysql/wordpress/wp_1059_posts.ibd
- I've tried to run table optimisation, but no impact
PARTITIONed
? Many columnsCHAR
as opposed toVARCHAR
?SHOW CREATE TABLE wp_wfLeechers;
before and after? AlsoSHOW TABLE STATUS LIKE 'wp_wfLeechers';