execute sql file from command line, Easiest way to execute multiple different query or n numbers of sql queries in single shot from mysql command line.
Before Execution
It can be done in 2 different way.
Login to Mysql
login to mysql using mysql -u root -p your_password;
then connect to database : use your_database_name
Run command : source yourfile.sql; (source Desktop/myquery.sql)
Without login to Mysql
mysql –u root –p your_password your_database_name < queryfile.sql;
example : mysql –u root –p your_password book_store < Desktop/myquery.sql;