MySQL: import a dump

Martin Zeller MySQL Leave a Comment

If you have got a sql-File and want to import it to your MySQL database then you can do this with a simple line in the shell:


mysql -u username -p password -h databaseservername  datebasename < sqlfile.sql

Example:
Say there is a local MySQL database, with a database called ‘mybestsellers’, we have got a dump file ‘/home/users/jripper/bestsellerdump.sql’ and we connect to our database with username ‘dbuser’ and password ‘xxx’
Our input at the shell would be:


mysql -u dbuser -p xxx -h localhost mybestsellers < /home/users/jripper/bestsellerdump.sql

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.