问题
Which files are the actual files holding the data in the tables in a mysql db?
I went to /var/lib/mysql/ and I can see there a bunch of relatively small directories corresponding to my tables, and a lot of files named servername-bin.0000001 etc.
Is the data stored in those files?
回答1:
It is installation specific, but if you've /var/lib/mysql , then:
- MyISAM tables will be stored in individual files in /var/lib/mysql/
databasename/ - InnoDB resides in /var/lib/mysql/ibdata (unless you've used the innodb_per_table setting, in which case it's stored much like for MyISAM tables)
回答2:
Check out the ibdata1 file and its ilk.
From the documentation:
"Two important disk-based resources managed by the InnoDB storage engine are its tablespace data files and its log files. If you specify no InnoDB configuration options, MySQL creates an auto-extending 10MB data file named ibdata1 and two 5MB log files named ib_logfile0 and ib_logfile1 in the MySQL data directory. To get good performance, you should explicitly provide InnoDB parameters as discussed in the following examples. Naturally, you should edit the settings to suit your hardware and requirements."
回答3:
It is stored in various files under that directory, yes. The exact files used depends on what engine the tables are using.
回答4:
a bunch of relatively small directories corresponding to my tables
Not a tables but databases
servername-bin.0000001
that's binary logs, it has nothing to do with data
why do you need to know, by the way?
来源:https://stackoverflow.com/questions/2659782/where-is-the-actual-data-in-a-mysql-db-stored-on-a-linux-machine