How to export databases through command line?

2019-03-09 20:13发布

I have URL of phpMyAdmin, I have username and password. How can I export all those databases? Because phpMyAdmin crashes when I try to export them, so I want to try it through command line.

3条回答
来,给爷笑一个
2楼-- · 2019-03-09 20:53
mysqldump -uUSERNAME -pPASSWORD -hHOSTNAME USER_DATABASE > FILENAME.sql

Then import using:

mysql -uUSERNAME -pPASSWORD -hHOSTNAME USER_DATABASE < FILENAME.sql
查看更多
Explosion°爆炸
3楼-- · 2019-03-09 21:01

mysqldump -u user -p db_name > db_file.sql

Edit: based on the comments on another answer.

If MySQL server allows for remote connections, then you can run this command on another machine you do have access to.

mysqldump -h hostname-of-your-server -u user -p db_name > db_file.sql

查看更多
Rolldiameter
4楼-- · 2019-03-09 21:03

If you want to export all databases at a single command at the same time, use the following command instead.

mysqldump -u <THE USERNAME> -p --all-databases > all_databases.sql
查看更多
登录 后发表回答