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

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

    You do not need to specify the name of the database on the command line if the .sql file contains CREATE DATABASE IF NOT EXISTS db_name and USE db_name statements.

    Just make sure you are connecting with a user that has the permissions to create the database, if the database mentioned in the .sql file does not exist.

提交回复
热议问题