LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-22-2004, 02:38 PM   #1
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
Mysql backup?


Hi

I was wondering if there is a way to backup the whole mysql database. Are there files I could copy and put them back in the next install? Or some other method of transporting all data to other machine?

Thanks!
 
Old 02-22-2004, 02:42 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
All you should need to backup is your mysql data directory and perhaps your my.cnf config file.
 
Old 02-22-2004, 02:49 PM   #3
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
I'll try that and see what happens Oh, where is the mysql data directory?
 
Old 02-22-2004, 02:58 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
The default on redhat 9 is:
/var/lib/mysql

Your exact location may vary depending on your install method and configure options.
 
Old 02-22-2004, 03:42 PM   #5
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
Thanks!

This helped me very much!

Thanks for the very quick response too!
 
Old 02-22-2004, 04:54 PM   #6
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
I did it. I transplanted the data from one machine to the other. But I got problems transplanting data from one database to another. I copied the content of the directory named after the database. However the mysql command did write the content of the new database. But the PHP couldn't connect to it. Does anybody have any idea why? Teoretically it should work. Unless the data is somehow connected to that particular database name. Which I doubt.
 
Old 02-23-2004, 02:52 PM   #7
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Are the database files readable and writeable my the user that mysql runs as?
 
Old 02-23-2004, 03:14 PM   #8
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
Yes they are readable and writeable by the user that mysql runs as. That is what bothers me. It should work right? Or do tables in MySQL save which database they belong to? I don't know.

Thanks for the quixk response though.
 
Old 02-23-2004, 03:17 PM   #9
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
If you didn't copy the privilages did you reassign them?
 
Old 02-24-2004, 08:51 AM   #10
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
I copied the files in a different directory. Under the mysql base directory. I have changed privileges with chown and chmod. What's good is that when running the command mysql and connecting to this new database, works great. But using this new database from PHP pages, doesn't work for some reason. I have no idea why this doesn't work.

Actually I have discovered one thing. I cant connect to the database with other user than root. Can I change some other privileges in mysql? All I have changed were the rwx privileges in linux command line. If I login as some other user, I can't connect to the new databse even in mysql. So this is probably the reason that this is not working, as I am running apache as a different user and not root as this is not recommended.

Is there some way to change privileges in MySQL?
 
Old 02-24-2004, 12:25 PM   #11
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Yes, that is what I was refering to, sorry if it wasn't clear. Login to your mysql server s root:
mysql -u root -p

Then at the "mysql>" prompt:
grant all on DATABASE_NAME.* to USER@localhost identified by 'PASSWORD';

You will need o change the items in capitals depending on your setup.
 
Old 02-24-2004, 01:18 PM   #12
marghorp
Senior Member
 
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Original Poster
Rep: Reputation: 45
Ok this is what I did

I used the command you told me and that locked me out for good. The command should change all the privileges for the user in question, right? I went into the database mysql and checked the database. All privileges to all users were set to "N". So I went and changed the privileges to users I want to have privileges. It works now. Thanks for help. I will have to review the mysql manual on commands regarding privileges for users.
 
  


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
How to Backup MySQL over the network gabriellai Linux - Enterprise 3 07-19-2005 09:42 AM
MYSQL backup problem wimpie_net Linux - Software 5 10-16-2003 04:03 PM
mysql backup ram_dhupkar Linux - General 13 09-09-2003 07:19 PM
mysql backup ram_dhupkar Linux - General 0 08-13-2003 03:46 AM
Backup MySQL w/ CRON tracer Linux - General 0 03-28-2003 11:40 AM

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

All times are GMT -5. The time now is 11:44 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