Import Bigger .SQL file with PHP or Terminal

Sometimes you can’t get your hands on phpMyAdmin or similar, here’s a simple script to import a .sql file with php where filename.sql is the src to your .sql file.

If you’ve got shell access to mysql, you can upload the .sql to your server and simply run:

mysql> use db_name; 
mysql> source /var/dir/file.sql;


Leave a Reply

%d bloggers like this: