Withdata Software

How to execute sql file at MySQL command line

If you’re at the MySQL command line mysql> you can declare the SQL file as source, like:

mysql> source 'path/to/test.sql';

Or use the MySQL command line client:

mysql -hhostname -uuser database < path/to/test.sql