Restore Database.
Using the below command, the database backup file can be restored to the new database that has been created. The command needs to be run from the directory where the dump file is saved, else the exact path of the database dump file needs to be specified in the command.
# mysql -u newdbuser -p newlayerstackdb < dbdump.sql
• mysql: The command used for restoring the database.
• newdbuser: The name of the database user associated with the database (replace with the name of the username).
• newlayerstackdb: The name of the database to which the backup will be restored (replace with the name of the database).
• dbdump.sql: The mysql backup dump file.
When the above command is executed, you will be prompted to enter the password of the database user. Once the password has been typed in, all the contents from the database dump file will be restored to the database newlayerstackdb
.
An example command for restoring a database using a database dump file is provided below:
In the above command, newdbuser
denotes the database username and layerstackdb.sql
is the database backup file from which the contents are restored to the database newlayerstackdb
.