Importing Data with MySQL Shell
This task describes how to import a MySQL Shell dump to a MySQL DB System.
This task requires the following:
-
MySQL Shell 8.0.27, or higher. Exports created by MySQL Shell 8.0.27, or higher, cannot be imported by earlier versions of MySQL Shell.
-
Data exported from a source MySQL Server following the instructions described in Exporting Data with MySQL Shell.
-
Enough storage space on your DB System for the data you intend to import. To check DB System storage space, see Viewing DB System Details.
-
You have run the
loadDump()
command indryrun
mode to check that there will be no issues when the dump files are loaded from a local directory into the connected MySQL DB System; for example:MySQL>JS> util.loadDump("/home/user1/tpchdump", {dryRun: true})
The following task uses loadDump()
utility to
load the schema that was exported in
Exporting Data with MySQL Shell.
To import a schema:
-
Start a MySQL Shell session and connect to the DB System; for example:
$> mysqlsh Username@HostNameOfMySQLDBSystem
For information about connecting to a DB System using MySQL Shell, see Connecting with MySQL Shell.
-
Run the following command to import the
tpch
schema using theloadDump()
utility.MySQL>JS> util.loadDump("/home/user1/tpchdump", {threads: 8})
where:
-
/home/user1/tpchdump
is the location of the MySQL shell dump files. -
threads
specifies the number of processing threads to use for this task. The default is 4. For best performance, it is recommended to set this parameter to twice the number of CPUs used by the target MySQL DB System.
-