• About Us
  • Privacy & Policy
HowTo's
  • Home
  • Commands
  • Linux
  • SCM
  • Git
  • Database
  • MySQL
  • Kubernetes
  • Docker
No Result
View All Result
  • Home
  • Commands
  • Linux
  • SCM
  • Git
  • Database
  • MySQL
  • Kubernetes
  • Docker
No Result
View All Result
HowTo's
No Result
View All Result
Home Database

Overriding –databases Option in mysqldump

June 22, 2024
in Database, Database Commands Examples, Database Commands Tutorial, Database Tutorial, MySQL, MySQL Commands, MySQL Commands Examples, MySQL Tutorial
A A
0
11
SHARES
103
VIEWS
Share on FacebookShare on Twitter

The mysqldump command in MySQL is used to create backups of MySQL databases. It provides several options to customize the backup process. One such option is --tables, which allows you to specify particular tables to include in the backup, overriding the default behavior of dumping the entire database specified with --databases.

When using --tables, you list the names of the tables you want to dump after the option. Here are some examples to illustrate its usage:

Example 1: Dump a single table named users from the database mydatabase:

            mysqldump --tables mydatabase users
        

This command generates SQL statements that can recreate the users table from the mydatabase database.

Example 2: Dump multiple tables orders and customers from the database sales:

            mysqldump --tables sales orders customers
        

This command creates a backup containing the structure and data of both the orders and customers tables from the sales database.

Example 3: Dump tables from different databases, users from db1 and products from db2:

            mysqldump --tables db1 users db2 products
        

This command backs up the specified tables from their respective databases, db1 and db2.

Example 4: Dump all tables from a database testdb excluding a table named logs:

            mysqldump --tables testdb --ignore-table=testdb.logs
        

Here, the --ignore-table option is used in conjunction with --tables to exclude the logs table from the backup of testdb.

Example 5: Dump a table with a non-standard name, such as customer_data:

            mysqldump --tables sales customer_data
        

This command ensures that the customer_data table from the sales database is included in the backup.

Example 6: Dump all tables from a database archive:

            mysqldump --tables archive
        

This straightforward command creates a backup containing all tables from the archive database.

Example 7: Dump tables with a wildcard pattern, such as all tables starting with data_ from the database db1:

            mysqldump --tables db1 data_%
        

Here, data_% is used as a wildcard pattern to include all tables from db1 whose names start with data_.

Example 8: Dump a table with special characters in its name, like user_info:

            mysqldump --tables sales user_info
        

This command ensures that the table user_info from the sales database is backed up correctly, handling any special characters in its name.

Example 9: Dump tables from a database archive while specifying the path to store the dump file:

            mysqldump --tables archive > /path/to/backup.sql
        

This command redirects the output of mysqldump to a specific file location, /path/to/backup.sql, instead of printing it to the console.

Example 10: Dump tables using a configuration file myconfig.cnf that specifies database connection details:

            mysqldump --defaults-file=myconfig.cnf --tables mydatabase users
        

This command uses a configuration file, myconfig.cnf, to provide MySQL connection parameters and then dumps the users table from the mydatabase database.

Also check similar articles.

Creating Tab-Separated Output Files with mysqldump
Handling Failed SSL Session Data Reuse in mysqldump
Setting SSL Session Data File in mysqldump
Setting TLS 1.3 Cipher in mysqldump
Configuring SSL FIPS Mode in mysqldump (OpenSSL Only)

Tags: DatabaseDatabase Commands ExamplesDatabase Commands TutorialDatabase TutorialMySQLMySQL CommandsMySQL Commands ExamplesMySQL Tutorial
Previous Post

Creating Tab-Separated Output Files with mysqldump

Next Post

How to Create Kubernetes Resources from Files or Stdin

Related You may like!

howto

Creating Tab-Separated Output Files with mysqldump

June 22, 2024
howto

Handling Failed SSL Session Data Reuse in mysqldump

June 22, 2024

Setting SSL Session Data File in mysqldump

June 22, 2024

Setting TLS 1.3 Cipher in mysqldump

June 22, 2024

Configuring SSL FIPS Mode in mysqldump (OpenSSL Only)

June 22, 2024

Setting TLS Version in mysqldump

June 22, 2024
Next Post
howto

How to Create Kubernetes Resources from Files or Stdin

howto

Expose Kubernetes Services Easily with kubectl expose

howto

Running Docker Images on Kubernetes with kubectl run

Discussion about this post

Latest Updated

howto

How to Use -iname for Case-Insensitive Filename Searches in find

August 21, 2024
howto

Search for Files with Case-Insensitive Pattern Matching Using -ilname in find

August 21, 2024
howto

Find Files by Group Name with -group in find Command

August 21, 2024
howto

Locate Files by Group ID Using -gid in find Command

August 21, 2024
howto

How to Search for Filesystems with -fstype in find Command

August 21, 2024

Trending in Week

  • howto

    Using BTRFS Subvolume for User Home Directory in Linux

    22 shares
    Share 9 Tweet 6
  • Downloading Docker Images from a Registry

    13 shares
    Share 5 Tweet 3
  • Configuring SSL Connection Mode in mysqldump

    17 shares
    Share 7 Tweet 4
  • Omit Tablespace Information in mysqldump Output

    13 shares
    Share 5 Tweet 3
  • Setting MySQL Dump Compatibility Mode

    18 shares
    Share 7 Tweet 5
  • Setting Network Buffer Length in mysqldump

    13 shares
    Share 5 Tweet 3
  • Logging out from Docker Registries

    13 shares
    Share 5 Tweet 3
  • Scheduling Nodes in Kubernetes with kubectl uncordon

    12 shares
    Share 5 Tweet 3
  • Managing Default User Creation Settings in Linux

    15 shares
    Share 6 Tweet 4
  • Using Extended INSERT Syntax in mysqldump

    12 shares
    Share 5 Tweet 3
  • About Us
  • Privacy & Policy

© 2024 All Rights Reserved. Howto.swebtools.com.

No Result
View All Result

© 2024 All Rights Reserved. Howto.swebtools.com.