将数据从 MySQL DB 1 传输到 MySQl DB 2 的最快方法
我有一个新数据库,与旧数据库类似,但有更多列和表。 所以旧表上的数据仍然可用,需要转移。
旧数据库与新数据库位于不同的服务器上。 我想将数据从一个数据库传输到另一个数据库。
我有navicat,但似乎需要永远使用主机来托管数据传输。 另外下载一个 sql 文件然后执行也需要很长时间(每秒执行大约 4 次插入)。
下载的SQL文件大约40mb(包含完整的插入语句)。 最后一个可能是 60mb 到 80mb。
传输这些数据的最佳方式是什么? (这个过程我需要重复几次才能测试)
I have a new database, similar to the old one but with more columns and tables. So the data on the old table is still useable and needs transferring.
The old database is on a different server to the new one. I want to transfer the data from one database to the other.
I have navicat, but it seems to take forever using the host to host data transfer. Also downloading a sql file then executing that takes too long also (it executes about 4 inserts per second).
The downloaded SQL file is about 40mb (with complete insert statements). The final one would probably be 60mb to 80mb.
What's the best way to transfer this data? (a process I will need to repeat a few times for testing)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在源计算机上执行 mysqldump,然后在另一侧将其读取,即使是 40-100MB 的文件也是合理的。 从命令行执行此操作。
..将文件传输到收件人计算机...
Doing a mysqldump on the source machine and then slurping it in on the other side, even on a 40-100MB file is well within reason. Do it from the command line.
..transfer file to recipient machine...
能不能先只传输一部分数据进行测试? 然后,当您对测试结果感到满意时,转移整个内容?
Can you not transfer only a portion of the data for testing first? Then, later, transfer the entire thing when you're satisfied with test-results?
这听起来更像是您的数据库出了问题。您确定没问题吗?
That sounds more like there's something wrong with your database.. Are you sure that's alright?
科迪谢谢你的指导。 由于某种原因,它对我不起作用,但下面的内容在我的 redhat linux 服务器上起作用:(
接收机器)
mysql -u [用户名] -p -h 本地主机数据库 < 数据库.sql
(源机器)
我刚刚使用 php myadmin
是否有一个命令可以运行以从另一台服务器提取数据库,类似于: mysqldump -u [用户名] -p -h [主机地址] [dbname] > [文件名].sql
谢谢
Cody thank you for the direction. For some reason it did not work for me, but the below did on my redhat linux server:
(recipient machine)
mysql -u [username] -p -h localhost database < database.sql
(source machine)
I just used php myadmin
Is there a command that can be run to pull the DB from another server something along the lines of: mysqldump -u [username] -p -h [host address] [dbname] > [filename].sql
Thanks