Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 932
olamundo Avatar asked Apr 17 '10 19:04

olamundo


People also ask

Where is mysql data stored in Linux?

By default, the datadir is set to /var/lib/mysql in the /etc/mysql/mysql.

Where is the data of mysql stored?

The default data directory location is C:\Program Files\MySQL\MySQL Server 8.0\data , or C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The C:\ProgramData directory is hidden by default. You need to change your folder options to see the directory and contents.


2 Answers

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)
like image 184
nos Avatar answered Oct 01 '22 20:10

nos


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."

like image 25
janmoesen Avatar answered Oct 01 '22 20:10

janmoesen