Buy best selling Linux books

<< View More Computer Tips

Added On: 15/12/15   |    Category: Linux    |    Number of Views: 1450

Import - Export MySQL / MariaDB database 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.

PHPMyAdmin's strengths are it's ease of use when creating new databases, tables and fields. This can be done directly through your webbrowser, without the need to use the terminal.

Search Site

Search other tutorials and tips on My Computer Tips by entering your search terms below

Services

The Linux Foundation

Best selling Unix / Linux books
Nvidia Graphics Cards
Save 15% off .CO.UK domains at 123-Reg
Save 15% off .COM domains at 123-Reg
cPanel Hosting Plans
Xilo Web Hosting Plans