backup restore mysql
Restore mysql backups
Here is one approach to perform backup restore mysql.
- Create Backup files
- Create a Backup of the Database
- Restore Backup files
- Restore the Database Backup
It is pretty simple. Let us move on to the details of each step.
- Create backup file
- Create db backup
- Restore file backup
- Restore database backup
This is so pretty simple. Let the individual details of each step.
Create Backup files
You need an ftp client: FileZilla is fine. Download a full copy of all the files. Anyway, having access to ssh host, I suppose, it would be better to make a whole compressed tar file. You will first copy the whole thing.
We transfer a copy of the files on your computer. Moving on.
Create a Backup of the Database
There are at least two solutions. The first is this. Act directly in the Terminal and execute the command mysqldump:
# mysqldump-u dbuser-p password db > db.sql # gzip db.sql db.sql.zip
Alternatively, you can use a phpmydmin Panel. I must say it is always less fashionable, and so is less frequently. In the event, normally just log into the Panel and then select the Database. Then there is the export command and follow the instructions below, making sure to export in compressed format ‘ gzip ‘. Now always with fileZilla, you can transfer a copy of the database on your PC.
Restore Backup files
If we had a compressed tar (tgz), trasferiamolo on new hosting, and then we get into ssh. You have to extract all the directory that will host the site.
If we made a copy of each file, then copy it with fileZilla individual files in the directory that will host the site.
Restore the Database Backup
In the new hosting, I doubt they’ll get phpMyAdmin. Anyway, if that is the case, do the same thing for the backup. Of course it starts with ‘ import ‘.
If, then, there is nothing but our beloved prompt … then, transfer the copy of the db on the new hosting and then scompattatela:
# gunzip db.sql.zip
Then to restore the dump on the new database, using new database credentials, execute the following command:
# mysql-u dbuser-p[password] [database_name]< db.sql
Chances are good that you have done.