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} > databasename.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.

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.
Home - Apache - Ubuntu - MySQL - PHP - Misc

The Ubuntu Counter Project - user number # 17415
Updated on: 2008-01-08 07:24:42