是不是可以将MyISAM表文件的路径更改为不同的挂载点?

huangapple go评论55阅读模式
英文:

Is it possible to change the path of MyISAM table files between different mount points?

问题

例如,如果我有MyISAM表格t1t2,是否可以将t1存储在/data1,而将t2存储在/data2

我如何通过MySQL(使用SQL)检查每个MyISAM表格的当前文件位置?它是否总是创建在datadir/db_name作为table_name.MYD和table_name.MYI扩展名?没有改变的方法吗?

英文:

For example, if I have MyISAM tables t1 and t2, it's possible to store t1 in /data1 and t2 in /data2?

How can I check the current file location of each MyISAM from MySQL (with sql)? is it always created in datadir/db_name as table_name.MYD and table_name.MYI extensions? no way to change it?

答案1

得分: 1

定位另一个卷上的MyISAM表的解决方案是使用符号链接。

符号链接仍然位于默认数据目录下,与其他模式和表一起。但符号链接引用的实际文件可能位于另一个文件系统上。

阅读https://dev.mysql.com/doc/refman/8.0/en/symbolic-links-to-tables.html了解详细信息。

请注意,MySQL 8.0中默认情况下禁用了此功能,并且它已被弃用,手册页面上有一个注释,说明此功能可能在将来的MySQL版本中被移除。

首选解决方案是停止使用MyISAM(有很多很好的理由),而改用InnoDB存储引擎。自2010年MySQL 5.5以来,InnoDB一直是默认的存储引擎,所以我有点惊讶你仍在使用MyISAM。

在MySQL 8.0中,InnoDB支持CREATE TABLE语句中的DATA_DIRECTORY子句。如果您考虑切换到InnoDB,请阅读此功能的详细信息:https://dev.mysql.com/doc/refman/8.0/en/innodb-create-table-external.html#innodb-create-table-external-data-directory

英文:

The solution for locating MyISAM tables on another volume is to use symbolic links.

The symbolic link still resides under the default data directory, with other schemas and tables. But the real file that the symbolic link references may be on another filesystem.

Read https://dev.mysql.com/doc/refman/8.0/en/symbolic-links-to-tables.html for details.

Note that this feature is disabled by default in MySQL 8.0, and it is deprecated and there's a note on that manual page that the feature may be removed in a future version of MySQL.


The preferred solution is to stop using MyISAM (there are many good reasons for this), and use the InnoDB storage engine instead. InnoDB has been the default storage engine since MySQL 5.5 in 2010, so I'm a bit surprised that you are still using MyISAM.

In MySQL 8.0, InnoDB supports a DATA_DIRECTORY clause in the CREATE TABLE statement. If you do consider switching to InnoDB, read about this feature here: https://dev.mysql.com/doc/refman/8.0/en/innodb-create-table-external.html#innodb-create-table-external-data-directory

huangapple
  • 本文由 发表于 2023年6月13日 09:24:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76461170.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定