Home Apache PHP Ubuntu MySQL Linux HTML Win CSS Perl Javascript Rants Retro
 
Print This Page
Date Posted: Sunday 07th of February 2010 | Category: MySQL
Import - Export MySQL using the terminal in Ubuntu Linux
Import - Export MySQL using the terminal in Ubuntu Linux
To Export your database using the terminal, in Ubuntu enter the following command:-

mysqldump -u {database_username} -p {database_name} > mysqlbackup.sql

You will be prompted for your MySQL password. Your database will then be downloaded.

To Import your database using the terminal in Ubuntu enter the following command:-

mysql -u {database_username} -p {database_name} < mysqlbackup.sql

You will be prompted for your MySQL password. Your database will then be imported.

Other ways to import and export MySQL:-
There are other ways to Import and Export your database using PHPMyAdmin.
This is fine for small imports and exports but most webhosts impose a 2MB limit on imports.

Using PHPMyAdmin on a live busy site, may also lock all the tables whilst importing or exporting the databases.

It also takes longer to import and export using this method. However, PHPMyAdmin's strengths are it's ease of use when creating new databases, tables and fields.

This can be done directly through your webbrowser.