如何将mysql数据库移动到另一个安装点
我有一个 MySQL 数据库,它变得越来越大,我想将整个数据库移动到另一个安装点,在那里我有足够的存储空间。 我希望传输当前数据,并将新数据保存到新位置。
软件堆栈:在 FreeBSD 6 上运行的 MySQL 5
I have a MySQL database, it is getting larger and larger and I want to move the whole database to another mount point, where I have enough storage. I want my current data to be transferred, and that new data get saved to the new position.
software stack: MySQL 5 running on FreeBSD 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然其他答案也是有效的。 但如果你想保留默认配置,请执行以下操作:
mv /var/lib/mysql /var/lib/mysql.backup
/var/lib/ 下安装新分区mysql
cp -r /var/lib/mysql.backup /var/lib/mysql
Of course other answers are valid. But if you want to keep the default configuration, do following:
mv /var/lib/mysql /var/lib/mysql.backup
/var/lib/mysql
cp -r /var/lib/mysql.backup /var/lib/mysql
这并不涉及任何魔法。 ;)
但您应该确保复制 MySQL 文件的所有权限。
There's no magic involved. ;)
But you should make sure, that you copy all permissions with the files of MySQL.
如果您可以容忍数据库因移动而关闭:
mysql.conf
以告诉MySQL在哪里可以找到这些文件,或者If you can tolerate the database being down for the move:
mysql.conf
to tell MySQL where to find the files, or