How to dump a table from a database

# [mysql dir]/bin/mysqldump -c -u username -ppassword databasename tablename > /tmp/databasename.tablename.sql

To dump a table from a MySQL database, you can use the mysqldump command-line tool. Here’s the basic syntax:

bash
mysqldump -u [username] -p [password] [database_name] [table_name] > [output_file.sql]

Replace [username] with your MySQL username, [password] with your MySQL password, [database_name] with the name of the database containing the table you want to dump, [table_name] with the name of the table you want to dump, and [output_file.sql] with the name of the file where you want to save the dumped data.

For example, if you want to dump a table named my_table from a database named my_database and save it to a file named my_table_dump.sql, you would run:

bash
mysqldump -u my_username -p my_password my_database my_table > my_table_dump.sql

After running this command, you’ll be prompted to enter your MySQL password. Once you enter it correctly, the table data will be dumped into the specified file.