Score:1

Dump a Table from MySQL Database directly from sql server using bash

ro flag

How can I dump a table from a MySQL database using a bash script?

Like we can use the below command to dump a table

mysql -u username -p database_name > file.sql

But how can I dump only a single table from a database?

Can someone please help me for the same?

jm flag
The command you gave does not dump any data. You should check to make sure you paste in the exact commands you've tried.
Score:1
ua flag

Very simple

#!/bin/bash
mysqldump -uUSERNAME -pPASSWORD DBNAME MYTABLE > DBNAME-MYTABLE.sql

For backup purposes you might want to add a date like this:

#!/bin/bash
cur=`date +"%Y-%m-%d"`
mysqldump -uUSERNAME -pPASSWORD DBNAME MYTABLE > DBNAME-MYTABLE-${cur}.sql
ph3ro avatar
ro flag
Thanks to so much :)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.