MySQL 如何使用ssh导出mysql数据库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8853788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:22:02  来源:igfitidea点击:

how can I export mysql database using ssh?

mysqlssh

提问by CryptoMiningPoolSetupYiimp

What commands I can use at ssh to export(download) mysql database using SSH?

我可以在 ssh 上使用哪些命令来使用 SSH 导出(下载)mysql 数据库?

回答by AlphaMale

To export a mysql dump using SSH, execute the following command:

使用 SSH 导出 mysql 转储,请执行以下命令:

mysqldump -u username -p dbname > db_dump.sql

username -> your mysql username
dbname   -> databse name

Enter password when prompted. and you are done.

出现提示时输入密码。你就完成了。

Have a look here: MySQL Import and Export (.sql file) via SSH

看看这里:MySQL Import and Export (.sql file) via SSH

Hope this helps.

希望这可以帮助。

回答by Ahmad Sajid

I guess its too late but for a detail answer for future reference:

我想为时已晚,但为了将来参考的详细答案:

mysqldump -uroot -p yourdbname > /var/dbbackup/backup.sql

here you can change the username root to yours -p will ask for your password later. and after the > you can mention your location where you want to save your backup file.

在这里您可以将用户名 root 更改为您的 -p 稍后会询问您的密码。在 > 之后,您可以提及要保存备份文件的位置。

回答by leoleovich

mysqldump db  | ssh test.host mysql db