aggaq.blogg.se

Mysql shrink database
Mysql shrink database












It just takes a little time and annoyance. So, after reading through MySQL's InnoDB Engine documentation and this answer on Stack Overflow, I found that it's not too hard to change MySQL to keep data tables in their own files, and delete the files after the tables are deleted (thus saving me a ton of space). Using Daisy Disk I just noticed that my ibdata1 file had grown to more than 10 GB, and my Air's drive only had about 5 GB free space! I develop a lot of sites on my little MacBook Air (with a 128GB SSD), so I often download database snapshots from live and testing environments, empty out the tables on my local environment, then import the database dumps. This isn't a bad thing, especially for those who have a lot of drive space, and not many databases that are altered or dropped quite frequently. If you delete something from MySQL or drop a table, the space that table was using is reallocated for other new data. This file never shrinks in size it only expands to contain new data.

mysql shrink database

One headache for me is that, by default, MySQL tells InnoDB to create one file on your system, called ibdata1, to hold ALL the data from EVERY InnoDB table you have on your MySQL server.

mysql shrink database

InnoDB provides many benefits, but can cause some unexpected headaches.














Mysql shrink database