0

I'm new to learn some database knowledge. I've learnt that I can implement an SQL file into some database to add, alter, delete or search records. But my question is how these tables and data store in the database? Is there any specific file in the hard disc storing every database or table? If so, how could I get the access?

  • When it comes in terms that you want to access it directly, what are your concerns? – Ricardo Silveira Jun 15 '16 at 03:44
  • For more details you can refer [here](http://stackoverflow.com/questions/10378693/how-does-mysql-store-data). – NnN Jun 15 '16 at 03:47
  • Hi, Ricardo. I just imagined the data file containing data information like a .txt file containing .txt information, but it seems not. – Fengshun Zang Jun 15 '16 at 04:06
  • Yes, it does not. It presumes you would like snappy results. Not forever to return your info. – Drew Jun 15 '16 at 04:28

1 Answers1

0

The file structure depends on the engine you are using, for example, MyIsam will store 3 files tableName.MYI (for indices) and tableName.MYD (for data) in linux /var/lib/mysql. Innodb (with it's default setting has everything stored in a single file called ibdata1)

You can't read the files above like you read a text file. You need to use the DB engine with SQL commands in order to reach the data.

irimawi
  • 368
  • 1
  • 9
  • so, the data files(perhaps one big file, perhaps many) are basically stored somewhere in my or any other host hard drives? – Fengshun Zang Jun 15 '16 at 04:17
  • They are stored in your hard drive assuming you have a local installation of the database, if you connect to a remote database, the files are stored remote on that server. You can tell when you connect whether you use localhost 127.0.0.1 or localhost as the host (then local) if anything with an external ip or domain name then it is remote. – irimawi Jun 15 '16 at 04:20
  • Thank you very much! That helps a lot. – Fengshun Zang Jun 15 '16 at 04:21