Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

export table using ssh

Tags:

mysql

I want to export a table of mysql database using ssh so how can I take this one.

like image 538
Rayan Avatar asked Jan 24 '26 21:01

Rayan


2 Answers

mysqldump -uuser -ppass dbname tablename >dump_table.sql
like image 107
Erdem KAYA Avatar answered Jan 27 '26 09:01

Erdem KAYA


  • Export the table to a file, using MySQLDump, PHPMyAdmin or your favorite tool.
  • Transfer the file to the host of your liking, using scp or your favorite tool.

What do you mean "export using SSH?" SSH is a protocol to securely talk to a server. SCP is a way to copy files between hosts using SSH, so I assume you mean that.

mysqldump db_name tbl_name >dumpfile
scp dumpfile 127.0.0.1:.

If you dislike mysqldump, you can always just SELECT INTO OUTFILE from your favorite MySQL client (or PHP program, or just the commandline mysql). After that you transfer the file to the other host, and run LOAD DATA INFILE to load the table. You'll have to recreate the table as well.

like image 32
Konerak Avatar answered Jan 27 '26 09:01

Konerak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!