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

后端 未结 30 2596
不知归路
不知归路 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:17

    You can try this query.

    Export:

    mysqldump -u username –-password=your_password database_name > file.sql
    

    Import:

    mysql -u username –-password=your_password database_name < file.sql
    

    and detail following this link:

    https://chartio.com/resources/tutorials/importing-from-and-exporting-to-files-using-the-mysql-command-line/

提交回复
热议问题