Import and export mySQL databases

So i have a 300MB database and it is real hard to import it with phpMyAdmin or other web based software.

This is why i want to do it with the simple linux command.

How can you do that?

Import a mysql database

After you created the database you need to put the following command:

mysql -u username -p new_database < /path/fo/file.sql

After you execute the file it will ask you the user mysql password.

Export a mysql database

Mysql export is very easy. For this you need to use the following command:

mysqldump -u username -p database_name > /path/to/file.sql

After you run this it will ask also for your password.

Leave a Reply

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

tutorials