MYSQL – Importing SQL

Say you have a mysql server and have a long list of sql files to import in a specific order. Some files are 20kb some are 400Mb phpmyadmin will keel over and die, all that stress is just unnecessary.

at bash/terminal console  execute this.


mysql -p123456 -h superserver megabase < /var/SQL/256.sql && mysql -p123456 -h superserver megabase < /var/SQL/257.sql

Explanation:

mysql= execute mysql command if at terminal or bash.
-p= the password flag, NOTE the password is supplied without a space.
-h= the host flag, the host is superserver.
megabase = the database that the sql will be imported into.
< = the import switch
/var/SQL/256.sql = the full path to the sql file.
&& = executes the next command only if the preceding command does not fail.

as show above you can chain 2 or even 100 import sql files.

  1. I want to say – thank you for this!

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>