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

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

    I kept running into the problem where the database wasn't created.

    I fixed it like this

    mysql -u root -e "CREATE DATABASE db_name"
    mysql db_name --force < import_script.sql
    

提交回复
热议问题