Import large .sql file into MySQL

后端 未结 2 773
难免孤独
难免孤独 2021-02-05 18:31

I have been given a VERY large mysql backup file. It is ~630 MB... I guess someone thought it was a good idea to store images in a database... Anyway, I need to

相关标签:
2条回答
  • 2021-02-05 18:33

    I had a 3.5G dump file, I tried to import it with PhpMyAdmin and MySql workbench but without success. So I just used the console to run it

    # mysql -u user_name -pYour_passwd your_db < your_dump.sql
    

    and it works great

    0 讨论(0)
  • 2021-02-05 18:49

    Increasing the wait_timeout and/or interactive_timeout should help. First check the current value:

    C:\> mysql -hlocalhost -uroot -proot
    
    mysql> SHOW VARIABLES LIKE 'wait_timeout';
    

    If this is very low (e.g. 30 seconds) then increase it (e.g. 5 minutes):

    mysql> SET SESSION wait_timeout = 300;
    mysql> SET SESSION interactive_timeout = 300;
    

    Then execute your SQL file:

    mysql> \. database.sql
    
    0 讨论(0)
提交回复
热议问题