How to export databases through command line?

后端 未结 4 1648
栀梦
栀梦 2021-02-01 05:43

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 c

相关标签:
4条回答
  • 2021-02-01 06:04

    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

    0 讨论(0)
  • 2021-02-01 06:07
    mysqldump -uUSERNAME -pPASSWORD -hHOSTNAME USER_DATABASE > FILENAME.sql
    

    Then import using:

    mysql -uUSERNAME -pPASSWORD -hHOSTNAME USER_DATABASE < FILENAME.sql
    
    0 讨论(0)
  • 2021-02-01 06:11

    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
    
    0 讨论(0)
  • 2021-02-01 06:18

    As i was logged into my server already there i just had to put this command to dump db

     mysqldump --databases  database_name > file_name.sql
    
    0 讨论(0)
提交回复
热议问题