LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-22-2010, 05:16 AM   #1
Glenn D.
Member
 
Registered: May 2009
Location: ACT - Australia
Distribution: Opensuse x86_64 (Latest)
Posts: 132

Rep: Reputation: 26
mysql restore database and id commands


Hello,
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.
 
Old 07-22-2010, 07:36 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Hi

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';
quit
mysql -u root -proot cacti <cacti-metadata-backup.sql

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restore MySQL Dump File But I want it to restore with different names? helptonewbie Linux - Newbie 5 07-08-2009 05:09 AM
mysql database restore help compused Linux - General 3 10-28-2008 04:48 PM
Restore Database RAH104 Linux - Server 3 07-05-2008 09:49 PM
mysql database restore problem sajith Programming 1 07-01-2007 06:36 AM
How do I restore a MySQL database simply dobriain Linux - Software 2 04-19-2006 12:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration