存储在 linux 机器上的 mysql 数据库中的实际数据在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2659782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 15:48:51  来源:igfitidea点击:

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

mysqlfilelocation

提问by olamundo

Which files are the actual files holding the data inthe tables in a mysql db?

哪些文件是存放数据的实际文件的表在MySQL数据库?

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.0000001etc.

我去了/var/lib/mysql/,我可以看到那里有一堆与我的表相对应的相对较小的目录,以及许多名为servername-bin.0000001等的文件。

Is the data stored in those files?

数据是否存储在这些文件中?

回答by nos

It is installation specific, but if you've /var/lib/mysql , then:

它是安装特定的,但如果你有 /var/lib/mysql ,那么:

  • 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)
  • MyISAM表将被保存在单独的文件在/ var / lib中/ MySQL的/ databasename/
  • InnoDB 驻留在 /var/lib/mysql/ibdata (除非您使用了 innodb_per_table 设置,在这种情况下,它的存储方式与 MyISAM 表非常相似)

回答by janmoesen

Check out the ibdata1file and its ilk.

查看ibdata1文件及其同类文件。

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

“InnoDB 存储引擎管理的两个重要的基于磁盘的资源是它的表空间数据文件和它的日志文件。如果你没有指定 InnoDB 配置选项,MySQL 会创建一个名为 ibdata1 的自动扩展的 10MB 数据文件和两个名为 ib_logfile0 和ib_logfile1 在 MySQL 数据目录中。为了获得良好的性能,您应该明确提供 InnoDB 参数,如以下示例中所述。自然,您应该编辑设置以适合您的硬件和要求。”

回答by Ignacio Vazquez-Abrams

It is stored in various files under that directory, yes. The exact files used depends on what engine the tables are using.

它存储在该目录下的各种文件中,是的。使用的确切文件取决于表使用的引擎。

回答by Your Common Sense

a bunch of relatively small directories corresponding to my tables

一堆与我的表相对应的相对较小的目录

Not a tables but databases

不是表而是数据库

servername-bin.0000001

服务器名-bin.0000001

that's binary logs, it has nothing to do with data

那是二进制日志,与数据无关

why do you need to know, by the way?

顺便说一句,你为什么需要知道?