Import SQL file into mysql

前端 未结 18 1431
盖世英雄少女心
盖世英雄少女心 2020-11-28 00:16

I have a database called nitm. I haven\'t created any tables there. But I have a SQL file which contains all the necessary data for the database. The file is

18条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 00:55

    For localhost on XAMPP. Open a cmd window and type

    cd C:\xampp\mysql\bin
    mysql.exe -u root -p
    

    Attention! No semi-colon after -p Enter your password and type

    use database_name;
    

    to select the database you need.

    Check if your table is there

    show tables;
    

    Import from your sql file

    source sqlfile.sql;
    

    I have put my file on C:\xampp\mysql\bin location in order to don't mix up with locations of sql file.

提交回复
热议问题