import sql file terminal code example
Example 1: linux command line import mysql database
# if your database is not locally hosted
mysql -u username -p -h dbhost dbname < filename.sql
Example 2: mysql load sql from file
mysql> use db_name;
mysql> source file_name.sql;
Example 3: import sql via command line
mysql> use db_name;
mysql> SET autocommit=0 ; source the_sql_file.sql ; COMMIT ;
Example 4: import sql from terminal
mysql -u <username> -p <databasename> < <filename.sql>