Import SQL file by command line in Windows 7

前端 未结 16 1467
攒了一身酷
攒了一身酷 2021-01-30 11:20

I want to import an SQL file (size > 500MB) into a database. I have wamp on my PC. Phpmyadmin does not work well with this size. I changed all parameters in php.ini (max_upload_

相关标签:
16条回答
  • 2021-01-30 11:53

    Related to importing, if you are having issues importing a file with bulk inserts and you're getting MYSQL GONE AWAY, lost connection or similar error, open your my.cnf / my.ini and temporarily set your max_allowed_packet to something large like 400M

    Remember to set it back again after your import!

    0 讨论(0)
  • 2021-01-30 11:55

    TRY THIS

      C:\xampp\mysql\bin\mysql -u {username} -p {databasename} < {filepath}
    

    if username=root ,filepath='C:/test.sql', databasename='test' ,password ='' then command will be

      C:\xampp\mysql\bin\mysql -u root  test < C:/test.sql
    
    0 讨论(0)
  • 2021-01-30 11:55

    If you don't have password you can use the command without

    -u
    

    Like this

    C:\wamp>bin\mysql\mysql5.7.11\bin\mysql.exe -u {User Name} {Database Name} < C:\File.sql
    

    Or on the SQL console

    mysql -u {User Name} -p {Database Name} < C:/File.sql
    
    0 讨论(0)
  • 2021-01-30 11:57

    To import database from dump file use:

    mysql -u UserName -p Password DatabaseName < FileName.sql 
    

    In wamp

    C:\wamp\bin\mysql\mysql5.0.51b\bin>mysql mysql -uroot -p DatabaseName < FileName.sql 
    
    0 讨论(0)
提交回复
热议问题