Backup all Databases including Users in MySQL
------------------------------------------------
If you want to backup all databases, users, and authentication:
# mysqldump -u root -p --all-databases > d:\alldatabases.sql
This will prompt you for the root password, save all of the databases including the users and authentication information. Everything is saved.
------------------------------------------------
If you want to restore all databases then use
# mysql -u root -p < d:\alldatabases.sql
This will prompt for password and then restore all of the complete mysql databases and users with authentication.
------------------------------------------------
If you want to backup a specific database called companydb:
# mysqldump -u root -p companydb > d:\companydb.sql
------------------------------------------------
If you only want to restore a single database called companydb:
# mysql -u root -p companydb < d:\companydb.sql
------------------------------------------------
If you are upgrading to a more recent version, then it is good to run mysql_upgrade:
# mysql_upgrade -u root -p
This will both attempt to configure the tables properly and check for errors.
|