Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export databases through command line?

Tags:

I have URL of phpMyAdmin, I have username and password. How can I export all those databases? Because phpMyAdmin crashes when I try to export them, so I want to try it through command line.

like image 588
good_evening Avatar asked Nov 21 '11 19:11

good_evening


People also ask

How do I export a database?

Confirm that SQL is selected under format. Click “Go”. Type the file name and select the directory where your exported database is to be saved in the 'Save File' dialogue box on your local computer. Click “Save” and the process of exporting will start.

How do I export from Mysqldump?

Step 1 — Exporting a MySQL or MariaDB Database You will need your database's name and credentials for an account whose privileges allow at least full read-only access to the database. Use mysqldump to export your database: mysqldump -u username -p database_name > data-dump. sql.


1 Answers

mysqldump -uUSERNAME -pPASSWORD -hHOSTNAME USER_DATABASE > FILENAME.sql 

Then import using:

mysql -uUSERNAME -pPASSWORD -hHOSTNAME USER_DATABASE < FILENAME.sql 
like image 134
matthiasmullie Avatar answered Oct 05 '22 13:10

matthiasmullie