Import SQL file by command line in Windows 7

前端 未结 16 1510
攒了一身酷
攒了一身酷 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:49

    If those commands don't seems to work -- I assure you they do --, check the top of your sql dump file for the use of :

    CREATE DATABASE {mydbname}
    

    and

    USE {mydbname}
    

    The last parameter {mydbname} of the mysql command can be misleading : if CREATE DATABASE an USE are in your dump file, the import will in fact be done in this database, not in the one in the mysql command.

    The mysqldump command that will prompt CREATE DATABASE and USE is :

    mysqldump.exe -h localhost -u root --databases xxx > xxx.sql
    

    Use mysqldump without --databases to leave out CREATE DATABASE and USE :

    mysqldump.exe -h localhost -u root xxx > xxx.sql
    

提交回复
热议问题