MYSQL使用符号连接出现1146

daniel_daniel 2012-09-25 10:32:25
我遇到了一个很头疼的问题,请大家帮看看。

我将A服务器数据库文件存到我的移硬盘里,然后在A服务器的MYSQL里使用 “符号连接” 方式连接到数据库库。

然后呢。我在B服务器上也是这么做,B服务器可以找到数据库,可以显示出所有,可是一双击表就显示 1146错误,找不到表。

请问这是什么问题呢?
...全文
414 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
wwwwb 2012-10-08
  • 打赏
  • 举报
回复
MYSQL HELP不是说了吗?Symlinks are fully supported only for MyISAM tables

如果你一定要用,修改引擎
daniel_daniel 2012-10-08
  • 打赏
  • 举报
回复
[Quote=引用 21 楼 的回复:]

你的LINUX系统版本是什么?
[/Quote]
是WIN的系统。
我己经找到原因了,我个人感觉好像不能实现我的目地。因为MYSQL系统表总是记录着数据的变化,我即使把我自己的数据库文件搞定了,我能在两个MYSQL系统之间独善其身吗?好像不行。
daniel_daniel 2012-10-08
  • 打赏
  • 举报
回复
[Quote=引用 20 楼 的回复:]

不如用真的symbol link.
windows下有类似命令,去sysinternal下一个吧
[/Quote]
我用的就是 slink 啊。我用的不是吗?
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
我认为我找到原因了。
mysql的information_schema数据负责记录表信息,在B服务器上没有数据库与表的信息,所以找不到表,即使数据库和表都能列出来,也打不开。
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
[Quote=引用 15 楼 的回复:]

还不如用主从复制
[/Quote]

可能给点资料吗?
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 的回复:]

根据MYSQL的HELP,必须更改为MyISAM引擎,
Symlinks are fully supported only for MyISAM tables
[/Quote]
我试试。我刚才百度了关于mysql自带的information_schema的数据库。文中说这个数据库记录了MYSQL数据与表之间的关系,是不是B服务器没有关于我的数据库信息呢。
wwwwb 2012-09-25
  • 打赏
  • 举报
回复
还不如用主从复制
wwwwb 2012-09-25
  • 打赏
  • 举报
回复
根据MYSQL的HELP,必须更改为MyISAM引擎,
Symlinks are fully supported only for MyISAM tables
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 的回复:]

表什么引擎,最好通过MYSQLDUMP备份、MYSQL恢复
[/Quote]

我的意图是让我的A和B服务器,全部指向我的移动硬盘的数据库文件。这样我就不用来回的恢复备份了。亲。

daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
表全是innodb的
wwwwb 2012-09-25
  • 打赏
  • 举报
回复
表什么引擎,最好通过MYSQLDUMP备份、MYSQL恢复
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 的回复:]

表什么引擎,根据MYSQL的HELP
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.” Keeping th……
[/Quote]

我一直在A服务器创建并使用我的数据库的,后来,我把数据库文件复制到我的移动硬盘里,并使用symlinks指向到了硬盘的存放地址,是好用的。
接下来,在B服务器上我使用了同样的方式,也是使用symlinks,然后指向我的移动硬盘,就出现1146.

PS:特别要说的一件事,我觉的很奇怪。就是我在A服务器上虽然好用,但你只要把存放数据库的文件夹的名字一改,我说的改是将symlinks文件里的路径和文件夹的名字一起改,理论上我想是好用的,可实际上不好用,出现的错误是1146,就是说数据库能看见,表也能列出来,可是一双击就1146.可见在A服务器上的MYSQL是通过一机制记录了表的存在关系。亲爱的wwwwb,你觉的呢?怎么办呢。
wwwwb 2012-09-25
  • 打赏
  • 举报
回复
表什么引擎,根据MYSQL的HELP
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.” Keeping that in mind, if you have a innodb table and would like to create symlinks for, you should change the engine type to myisam before symlinking.

在哪个服务器上建立Symlinks 的?
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]

A、B MYSQL版本、系统是否相同,
是有以下的限制的
The following limitations apply to the use of .sym files for database symbolic linking on Windows:


The symbolic link is not used if a directory with the same nam……
[/Quote]
查过了无以上限制。哎,看来大家都不常用呆。
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
完全相同哦 亲爱的wwwwb
wwwwb 2012-09-25
  • 打赏
  • 举报
回复
A、B MYSQL版本、系统是否相同,
是有以下的限制的
The following limitations apply to the use of .sym files for database symbolic linking on Windows:


The symbolic link is not used if a directory with the same name as the database exists in the MySQL data directory.


The --innodb_file_per_table option cannot be used.


If you run mysqld as a service, you cannot use a mapped drive to a remote server as the destination of the symbolic link. As a workaround, you can use the full path (\\servername\path\).
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
我的问题比上面的问题更加升级了而己。
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
以前有人问过。

http://topic.csdn.net/t/20060802/15/4922245.html
daniel_daniel 2012-09-25
  • 打赏
  • 举报
回复
符号连接方式,文档内容如下:
2.6.2.5 Splitting Data Across Different Disks on Windows

Beginning with MySQL Version 3.23.16, the mysqld-max and mysql-max-nt servers in the MySQL distribution are compiled with the -DUSE_SYMDIR option. This allows you to put a database on different disk by adding a symbolic link to it (in a manner similar to the way that symbolic links work on Unix).

On Windows, you make a symbolic link to a database by creating a file that contains the path to the destination directory and saving this in the `mysql_data' directory under the filename `database.sym'. Note that the symbolic link will be used only if the directory `mysql_data_dir\database' doesn't exist.

For example, if the MySQL data directory is `C:\mysql\data' and you want to have database foo located at `D:\data\foo', you should create the file `C:\mysql\data\foo.sym' that contains the text D:\data\foo\. After that, all tables created in the database foo will be created in `D:\data\foo'.

Note that because of the speed penalty you get when opening every table, we have not enabled this by default even if you have compiled MySQL with support for this. To enable symlinks you should put in your `my.cnf' or `my.ini' file the following entry:

[mysqld]
use-symbolic-links

In MySQL 4.0 we will enable symlinks by default. Then you should instead use the skip-symlink option if you want to disable this.


是直接COPY数据库文件。在A服务器是好用的哦。只是到了B服务器,在使用这种方式,感觉少了些什么,不好用。
wwwwb 2012-09-25
  • 打赏
  • 举报
回复
什么是 符号连接 方式?
没有通过MYSQLDUMP备份、MYSQL恢复?直接COPY数据库?表什么引擎?详细说明
加载更多回复(4)

56,678

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧