将MySQL InnoDB数据库移动到单独的驱动器 [英] Moving MySQL InnoDB database to separate drive

查看:71
本文介绍了将MySQL InnoDB数据库移动到单独的驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MySQL安装中,我有一个InnoDB数据库,我知道它会变得非常大,因此我决定将其移到其自己的磁盘上.我希望通过将文件移动到另一个磁盘上然后创建一个符号链接来做到这一点,但是我遇到了错误!

In my MySQL installation I have one InnoDB database that I know will grow very large so I have decided to move it to its own disk. I was hoping to do this by moving the files to the other disk and then create a symlink but I run into errors!

这就是我所做的:

1)在my.cnf中,我已设置

1) In my.cnf I have set

[mysqld] innodb_file_per_table

[mysqld] innodb_file_per_table

(这可行,我在数据库文件夹中的每个.frm文件都有一个.ibd.)

(This works, I have one .ibd per .frm in the database folder.)

2)我用SHOW VARIABLES LIKE "have_symlink";

(我知道文档中说:

仅完全支持符号链接 MyISAM表.对于由...使用的文件 其他存储引擎的表,您 如果您尝试可能会遇到奇怪的问题 使用符号链接.

Symlinks are fully supported only for MyISAM tables. For files used by tables for other storage engines, you may get strange problems if you try to use symbolic links.

但是我需要外键...)

But I need foreign keys...)

3)我移动了数据库文件夹并创建了符号链接.

3) I moved the database folder and created a symlink.

4)重新启动mysql并尝试:

4) Restarted mysql and tried:

 mysql> USE db_name
 Database changed
 mysql> SHOW TABLES;
 ERROR 1018 (HY000): Can't read dir of './db_name/' (errno: 13)
 mysql> exit
 user@comp# perror 13
 OS error code  13:  Permission denied

符号链接是(如预期的那样)lrwxrwxrwx mysql mysql db_name -> /path-to/db_name/

symlink is (as expected) lrwxrwxrwx mysql mysql db_name -> /path-to/db_name/

数据库文件夹权限为drwx------ mysql mysql

所有文件权限均为-rw-rw---- mysql mysql

我正在将Ubuntu 10.04 Server与MySQL 5.1.41(默认为apt)配合使用.

I am using Ubuntu 10.04 Server with MySQL 5.1.41 (default from apt).

你们中的任何一个人成功完成了吗?

Have any of you done this successfully?

推荐答案

我不确定您的解决方案是最好的主意.在这里查看我的帖子:

I'm not sure your solution is the best idea. See my post here:

这里还有另一个线程:

Innodb;多个数据目录

这篇关于将MySQL InnoDB数据库移动到单独的驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆