How do I import an SQL file using the command line in MySQL?

后端 未结 30 2286
不知归路
不知归路 2020-11-22 06:48

I have a .sql file with an export from phpMyAdmin. I want to import it into a different server using the command line.

I have a Windows Ser

30条回答
  •  遇见更好的自我
    2020-11-22 07:16

    Go to the directory where you have MySQL.

     c:\mysql\bin\> mysql -u username -p password database_name <
     filename.sql
    

    Also to dump all databases, use the -all-databases option, and no databases’ name needs to be specified anymore.

    mysqldump -u username -ppassword –all-databases > dump.sql
    

    Or you can use some GUI clients like SQLyog to do this.

提交回复
热议问题