-   Linux - Software (
-   -   mysql restore database and id commands (

Glenn D. 07-22-2010 05:16 AM

mysql restore database and id commands
I used this command to Backup a mysql database [name is cacti]
- /usr/bin/mysqldump -uroot -proot cacti > cacti-metadata-backup.sql

How do I restore Restore this database, on a system that has a clean install of mysql on it.

Also I need to restore the owner of this data [in this case cacti]
How do I restore the owner and password for create a new one.

Guttorm 07-22-2010 07:36 AM


The password is not included in the backup. So you need to find the password somewhere else, or just make up a new one.

Anyway, to restore that backup, you first create the database, grant access to it, and then pipe the sql file into mysql. Something like this:

mysql -u root -proot
create database cacti;
grant all privileges on cacti.* to cacti@localhost identified by 'cactipassword';
mysql -u root -proot cacti <cacti-metadata-backup.sql

This assumes the root password is root. I suggest you change it to something else.

All times are GMT -5. The time now is 03:19 AM.