Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL dump inside mysql console

Tags:

mysql

Is there SQL command where you can do MySQL dump inside the MySQL console?

I tried mysqldump but it does not work...

I'm trying to output into SQL file.

like image 974
John Kim Avatar asked Feb 27 '12 06:02

John Kim


People also ask

How do I dump a MySQL database in terminal?

To dump entire databases, do not name any tables following db_name , or use the --databases or --all-databases option. To see a list of the options your version of mysqldump supports, issue the command mysqldump --help .

Where MySQL dump file is located?

The mysqldump tool is located in the root/bin directory of the MySQL installation directory.


1 Answers

You cannot run mysqldump within a MySQL console since mysqldump is an external command like the mysql console.

Exit the console and use the mysqldump command as follows:

mysqldump -u username -p -h hostname (or ip address) databasename > sqlfilename

It will ask for password.

More details of mysqldump can be found at http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

like image 98
Stephen Senkomago Musoke Avatar answered Sep 17 '22 17:09

Stephen Senkomago Musoke