### 7.4.2 Reloading SQL-Format Backups

 To reload a dump file written by [**mysqldump**](mysqldump.html) that consists of SQL statements, use it as input to the [**mysql**](mysql.html) client. If the dump file was created by [**mysqldump**](mysqldump.html) with the [`--all-databases`](mysqldump.html#option_mysqldump_all-databases) or [`--databases`](mysqldump.html#option_mysqldump_databases) option, it contains [`CREATE DATABASE`](create-database.html) and [`USE`](use.html) statements and it is not necessary to specify a default database into which to load the data:

```
$> mysql < dump.sql
```

 Alternatively, from within [**mysql**](mysql.html), use a `source` command:

```
mysql> source dump.sql
```

 If the file is a single-database dump not containing [`CREATE DATABASE`](create-database.html) and [`USE`](use.html) statements, create the database first (if necessary):

```
$> mysqladmin create db1
```

 Then specify the database name when you load the dump file:

```
$> mysql db1 < dump.sql
```

 Alternatively, from within [**mysql**](mysql.html), create the database, select it as the default database, and load the dump file:

```
mysql> CREATE DATABASE IF NOT EXISTS db1;
mysql> USE db1;
mysql> source dump.sql
```

Note

 For Windows PowerShell users: Because the "\<" character is reserved for future use in PowerShell, an alternative approach is required, such as using quotes `cmd.exe /c "mysql < dump.sql"`.

