How do I import an SQL file using the command line in MySQL?

后端 未结 30 2236
不知归路
不知归路 2020-11-22 06:48

I have a .sql file with an export from phpMyAdmin. I want to import it into a different server using the command line.

I have a Windows Ser

30条回答
  •  一向
    一向 (楼主)
    2020-11-22 07:27

    Regarding the time taken for importing huge files: most importantly, it takes more time because the default setting of MySQL is autocommit = true. You must set that off before importing your file and then check how import works like a gem.

    You just need to do the following thing:

    mysql> use db_name;
    
    mysql> SET autocommit=0 ; source the_sql_file.sql ; COMMIT ;
    

提交回复
热议问题