You can backup a
table in a MySQL or MariaDB database by using the
mysqldump backup tool included with both database
management systems. To backup a specific table you can use the command
mysqldump database_name table_name
where
database_name is the name of the database that contains the table and
table_name is the name of the particular table you wish to backup. E.g.:
mysqldump -u ptolemy -p Planets Mars > Mars.sql
In the above case, if I have a database named Planets
with
a table within it named Mars
, I could backup just that one table
from the database with the command above. The -u
option to the
command allows you to specify a MySQL/MariaDB username that has access to
the database and the -p
option will prompt you for the password
associated with that username. The Mars.sql
file will then
contain all of the
Structured Query
Language (SQL) commands needed to recreate the table structure and the
data in the table. E.g., it will contain insert
SQL commands that will insert entries in the table.
[ More Info ]