To backup(dump) single mysql database to a file , first we need to open the terminal and use the below syntax
Username = this is your database username
databasename = the name of your database which you want to backup
backup.sql = the filename for your database backup
Example:
-p is for mysqldump to ask for password,
plist is the name of the database
backuplist.sql is the file to dump the database.
To restore back mysql database from dumpfile:
Method:1 Open the terminal , use below command
Method:2 From inside mysql console where we have to access mysql console first:
# mysqldump -u <username> -p <databasename> > backup.sql
databasename = the name of your database which you want to backup
backup.sql = the filename for your database backup
Example:
# mysqldump -u root -p plist > /root/backuplist.sql
where -u is for username, -p is for mysqldump to ask for password,
plist is the name of the database
backuplist.sql is the file to dump the database.
Method:1 Open the terminal , use below command
# mysql -u root -p plist < /root/backuplist.sql
-u and -p are similar to above, plist is the name of the database and backuplist.sql is the name of the dumpfile.Method:2 From inside mysql console where we have to access mysql console first:
mysql> source backuplist.sql
or
mysql> \. backuplist.sql
where backuplist is the dumpfile or
mysql> \. backuplist.sql
Comments
Post a Comment