LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 01-01-2006, 12:47 PM   #1
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Rep: Reputation: 30
Exclamation Need to restore databases!


The other day I decided to reinstall everything on my server. Not knowing there was an alternative (mysqldump), I started by backing up the entire databases directory (/var/lib/mysql). Now I have that databases directory on a CD, but when I copy all of the files from a database to a new database with root, only the root mysql user has write permissions. How can I give the correct owner read and write access to their database?
 
Old 01-01-2006, 01:07 PM   #2
chandan
Member
 
Registered: Feb 2003
Location: Bangalore, India
Distribution: Fedora Core 2
Posts: 60

Rep: Reputation: 15
You can create the required users and give necessary permissions to the corresponding databases using the GRANT command.
http://dev.mysql.com/doc/refman/5.0/en/grant.html gives the usage of the command.
 
Old 01-01-2006, 01:16 PM   #3
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
Thanks a lot.
 
Old 01-01-2006, 01:49 PM   #4
chandan
Member
 
Registered: Feb 2003
Location: Bangalore, India
Distribution: Fedora Core 2
Posts: 60

Rep: Reputation: 15
You are welcome
 
Old 01-01-2006, 02:53 PM   #5
newuser455
Member
 
Registered: May 2004
Location: Texas
Posts: 277

Original Poster
Rep: Reputation: 30
That did not solve the problem. I still get an error saying that the tables are read-only.

Last edited by newuser455; 01-01-2006 at 02:57 PM.
 
Old 04-19-2006, 12:02 PM   #6
mackdav
Member
 
Registered: Feb 2005
Distribution: RHEL, CentOS
Posts: 113

Rep: Reputation: 16
Sounds like the ownerships of the files in /var/lib/mysql are incorrect; you probably need to chown them so that the mysql user (or whichever user runs mysqld) has read/write permissions to them.

Check to see what they were on the originating computer and use that as a guide; also check the names of the user which runs mysqld on both sides.

Or if you have the time/bandwidth to re-copy them, use tar instead of cp:

# cd /var/lib/mysql
# tar cfpz mysql.tgz

...then extract that on the other side with

# tar xvfpz mysql.tgz

(It might be a good idea to back up your original copy first.)
 
  


Reply

Tags
mysql


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
programming and databases msound Programming 6 05-05-2005 04:52 PM
databases varun_33 Linux - Software 2 02-03-2005 12:49 AM
Sql databases CurlyMo Linux - General 5 02-12-2003 04:31 AM
mysql databases k3v0 Linux - Software 2 12-03-2002 07:41 PM
Databases frankyboy4 LQ Suggestions & Feedback 1 08-09-2002 01:27 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration