Import SQL file by command line in Windows 7

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

    I use mysql -u root -ppassword databasename < filename.sql in batch process. For an individual file, I like to use source more because it shows the progress and any errors like

    Query OK, 6717 rows affected (0.18 sec)
    Records: 6717  Duplicates: 0  Warnings: 0
    
    1. Log in to MySQL using mysql -u root -ppassword
    2. In MySQL, change the database you want to import in: mysql>use databasename;

      • This is very important otherwise it will import to the default database
    3. Import the SQL file using source command: mysql>source path\to\the\file\filename.sql;

提交回复
热议问题