将MySQL数据库拆分为表 [英] Splitting MySQL database into tables separate

查看:128
本文介绍了将MySQL数据库拆分为表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我不是一个好的开发人员或数据库专家。但我对这些事情有一点了解。我试图使用mysqldump命令在VPS上转储数据库工作完美。但是当我试图在下载转储后本地恢复,给我一个超时错误。



任何人都可以建议我如何转储数据库通过分割成表。我所指的数据库相当大(6 - 7 GB)。我实际上试图搜索,它困惑我..甚至这 链接到此处 会让我从哪里开始。



非常感谢任何帮助。

解决方案

非常感谢您的所有答案!嗯,我正在寻找的是一个转储方法或类似的脚本转储数据库表的表。最后,我尝试用一​​个 .txt 扩展名转储输出文件,返回成功。



命令我使用(我知道它很漂亮的过程,但我终于得到所有表转储);


mysqldump -u users -p database_name table_name > table_name.txt


我使用当前目录输出文件,假设我已经在我需要转储的目录中。如果需要将输出文件转储到特定的目录,请使用 /path/to/the/dump/table_name.txt ,而不仅仅是提到表名。请务必在 -p 后输入密码。我不知道为什么,但我把它留空,它提示输入密码。然后,当我输入密码,它转储到一个文本文件。



我希望这有帮助。



再次感谢您对来自第一位帮助我的用户。 :)


Well I'm not much of a good developer or a database expert. But I have a little understanding of these things. I'm trying to dump a database on a VPS using "mysqldump" command which works perfectly. But when I tried to restore locally after downloading the dump, gives me a time out error.

Can anyone advise me how to dump a database by splitting it into tables separately. The database I'm referring to is pretty large (6 - 7 GB). I actually tried searching and it confuses me.. even this link here confuses me as where to start.

Any help is highly appreciated.

解决方案

Thank you so much for all your answers! Well, what I was looking for is a dumping method or a similar script to dump the database table by table. Finally I tried the dumping the output file with a .txt extension which returned me with success.

Below is the command I used (I know its pretty long proceess, but I finally got all tables dumped);

mysqldump -u users -p database_name table_name > table_name.txt

I used the current directory to output the file assuming I'm already in the directory where I need to dump. If you need to dump the output file to a specific dir, then use /path/to/the/dump/table_name.txt instead of just mentioning the table name. Ans make sure you don't enter password after -p. I don't know why, but I left it blank and it prompts for the password. Then when I type password it dumps to a text file.

I hope this helps.!

Once again thank you so much for the users who came in the first place to help me. :)

这篇关于将MySQL数据库拆分为表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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