简体   繁体   中英

MySql not saving to disk

I am storing data to a MySql database via a PHP script. The database is not being stored to disk, but queries are being stored in the database in memory. When I run mysqldump, the file size is about 130M, but when I check the file size located in "/var/lib/mysql/db_name" it is about 80K. The engine I am using is InnoDB.

How do you know it is not being stored to disk?

If you are making an assessment based on those sizes you are not likely not comparing the same things.

The db itself is just pure data.

The mysqldump has all the long winded actual create statements that can be much longer.

eg

Data: 1,5000,23,300  4 bytes.

Create statements from backup:
insert into summary_categories(category_sum_product) values (1);
insert into summary_categories(category_sum_product) values (5000);
insert into summary_categories(category_sum_product) values (12);
insert into summary_categories(category_sum_product) values (300);
= 262 characters/bytes

There is one way to check if it's stored to disk or memory. Restart the machine and if the data is still there it's stored on disk (which will be the case).

So to test further use this query to see where the data is stored:

SHOW VARIABLES WHERE variable_name LIKE '%datadir%'

Then inside that directory there will probably be a folder with the database name. Check inside that folder for the files with your table name. There is one for the definition (table.frm). This will probably be the one you see which can be 80K and there is another one (tablename.ibd) which holds the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM