where is the actual data in a mysql db stored on a linux machine? [closed]

醉酒当歌 提交于 2020-01-10 17:46:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!