LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-07-2008, 09:08 PM   #1
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Rep: Reputation: 31
dual boot two linux distro's with mysql and apache


EDIT:
It's basically like this. Find out the id of mysql on your current system like this:
id mysql
let's say that give you the response 77.

next you install your other linux distro, including mysql. through id mysql you find that the uid is 74. then execute these lines as root.
groupmod -g 77 mysql
usermod -u 77 -g 77 mysql
find / -user 74 -exec chown 77 {} \;

Then mount your mysql partition in the normal place and you're set to go.

_____
i realize there is already a thread that relates to dual booting apache and mysql, but it is not for to linux distributions:


i am running mandriva as my main distro and several other systems. i'm working on debian now. i'm wondering how i can configure my other partitions to be seen by both systems.

i use the same login name and password on both systems. the uid is probably also both 501.

i would like to be able to access my files partition, my mysql and apache partitions on both distro's.

is there a way?

Last edited by secretlydead; 01-13-2010 at 03:53 AM. Reason: heaven forbid anyone follow the old advice
 
Old 02-07-2008, 09:12 PM   #2
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: The Tropics
Distribution: Slackware & Derivatives
Posts: 2,472
Blog Entries: 1

Rep: Reputation: 128Reputation: 128
Ok. first of all, you're likely to get flamed anywhere else if you write "linuces". Go with "multiple linux distros" or something. We are a very sensitive community... ;-)

Second, you either have Grub or Lilo for a boot manager. Do you know which it is?
 
Old 02-08-2008, 08:02 AM   #3
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by phantom_cyph View Post
Ok. first of all, you're likely to get flamed anywhere else if you write "linuces". Go with "multiple linux distros" or something. We are a very sensitive community... ;-)
changed. yes, that was silly of me. two linuces would mean something like, kernel 2.6.5 and kernel 2.6.4.

Quote:
Originally Posted by phantom_cyph View Post
Second, you either have Grub or Lilo for a boot manager. Do you know which it is?
two, in fact. grub loads up and then gives a choice between slackware, redflag, mandriva, and debian.
most go directly, but the mandriva partition has lilo on it.

the fstab in the mandriva distro is as follows:
/dev/sda13 /var/lib/mysql ext3 defaults 1 2
/dev/sda12 /var/www/ ext3 defaults 1 2

so, i'd like to do the same thing in the debian distro. i can already; the problem is permissions. the usernames for each distro are the same - i think the uid is the same too. i'm switching to debian now and i use php/mysql everyday, i need quick access to the same files when i reboot.
 
Old 02-08-2008, 03:17 PM   #4
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: The Tropics
Distribution: Slackware & Derivatives
Posts: 2,472
Blog Entries: 1

Rep: Reputation: 128Reputation: 128
Hmmm. I've never booted any more than 2 OS's on my computer at once. So, there isn't a lot I can do. And, it was always a Linux and BSD, or Linux and Windows. Hopefully someone else can help you with this...

Sorry.
 
Old 02-08-2008, 08:14 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Are you *sure* it is a permissions issue?

If so, it is very unlikely that your uid is 501 on both systems. Debian starts default with 1000.

If you have some files for which you are surely the owner, do ls -ln when booted into both distro's. Do also a 'cat /etc/passwd' and 'cat /etc/group in both systems. You should see the uid and gid if your username, and they should be equal.

If they are not, study and use the usermod command to set your uid and gid. The easiest way is to do this on the system which has different uid and gid from the uid of your files. So the uid of 'you' becomes equal to the uid of the files.

If you think you have to change the uid of all the files you own as well, google for "change uid linux files" and you should find some neat tools to do that. I forgot which command should be used to change the uid of all your files on a system.

Can you access you files as root? If not, the root uid is perhaps different as well, and the same story applies. Although I thought root always had the same uid in Linux.

jlinkels
 
Old 02-12-2008, 08:31 AM   #6
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
some advice

first, thanks.

second, advice:

you'll need to know the uid and gid of your old mysql installation and your new one as well.

so, if you're on your new system, your old one is mounted at /mnt/mandriva, then you do this:
cat /mnt/mandriva/etc/passwd|grep 'mysql'

you should also do it for your new system:
cat /etc/passwd|grep 'mysql'

then you can change it the usermod and groupmod commands.

that much we know from jinkels.

then you can find all the files that you have to change.
find / -xdev -gid (number you just got)
(-xdev says not to descend into other mounted filesystems)
and
find / -xdev -uid (the other number you just got.

you change them with the chgrp and chown commands.

test that everything's correct by /etc/init.d/mysql restart or services mysqld restart or however your system does it.

now, DO NOT delete your /var/lib/mysql/ directory. just leave it the way it is and mount over it with your mysql partition (let's say it's located at /dev/sda13).
mount /dev/sda13 /var/lib/mysql/

now, your mysql directory should be mounted but you can unmount it in case you can't get it to work with your new system.

basically, all you have to do is copy the other files over and you're cool, as long as your mysql partition doesn't already have the same filenames on there.
 
Old 02-12-2008, 10:01 AM   #7
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Aaahh... I found the commands again to change all uid's over the disk:

Code:
find / -uid  1001 -print > /tmp/uid.1001
cat /tmp/uid.1001   | xargs -v chown jlinkels
The first line is equal to what secretly dead wrote, but without the -xdev. Sometimes you want to use xdev, sometimes not, depending what your mounts are.

The magic is in piping the output of find in a file, and pipe that file again in the xargs command. You could even skip the save into file parts, but I wanted to check what I did. (Should do this always when working as root!)

From the man page of xargs:

xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments followed by items read from standard input. Blank lines on the standard input are ignored.


jlinkels
 
Old 02-13-2008, 03:07 AM   #8
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by jlinkels View Post
I found the commands again to change all uid's over the disk:
There was no reason to do this in Debian. All files on the root system owned by that user name were changed when I did a usermod. (They may have also changed on the other partitions, but I don't know because the uid would have stayed the same.)

Quote:
Originally Posted by secretlydead View Post
basically, all you have to do is copy the other files over and you're cool, as long as your mysql partition doesn't already have the same filenames on there.
There should be at least three files, two called *log* and a folder mysql. On Debian, there were a few more.

When you copy these, DO NOT use the cp command, which will result in your user being the owner and silly permissions.
Instead use tar and archive them and then untar them into the appropriate directory.

This also gives you a handy backup, although I was able to tar copy all the files with no problems in either distro, both of which are now both working with the same www partition, mysql partition, and thunderbird partition. This is making it very possible for me to "try out" a new distro. Both of them are in good working fashion and have access to all the files that I need for work.
 
Old 02-13-2008, 06:29 AM   #9
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by secretlydead View Post
There was no reason to do this in Debian. All files on the root system owned by that user name were changed when I did a usermod.
In my case I had some other file subtrees (under /var) which were owned by me, so I used the xargs by default. I was not aware of this functionality of usermod, but you are right, there might be no need for xargs.
 
Old 02-13-2008, 08:36 PM   #10
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Original Poster
Rep: Reputation: 31
Grants!!!

OPTION 1:

GRANTS are really important in your database before you copy over the new mysql table folder.

do this on your database:

select User,Host from mysql.user;

then for each of those, do:

show grants for whoever;


it's pretty easy just to copy those and use leafpad to find/replace to change them the way you need them to execute them on the server once you put on the new mysql folder. this is also a good way to clean up your permissions if you tend to give a lot when you develop programs.

------------------------------

OPTION 2 (THIS IS THE ONE I DID!):

on the new database installation, this command:
select * from mysql.user;
will get you started. you'll see right away what you need to do to the old user database, if anything.

if you're going to keep your old user table (in the mysql database/folder), you might run into a problem with debian when you try to /etc/init.d/mysql restart:
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

fix that with:
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'xxxxxxxxxxxxxxx' WITH GRANT OPTION

look in the file /etc/mysql/debian.cnf for 'xxxxxxxxxxxxxxxxxx' to find out what that is


http://ubuntuforums.org/archive/index.php/t-112505.html

Last edited by secretlydead; 02-14-2008 at 03:44 AM.
 
  


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
dual booting Linuces Prasanna Rajaram Linux - Distributions 3 06-23-2007 08:02 PM
Apache/ADVX and dual boot jbrasher Mandriva 0 07-02-2004 01:47 PM
Starting apache and mysql as service on boot :: buddy Linux - General 2 12-30-2002 02:51 PM
MySQL (not working with Apache on first boot) Rhapsodic Linux - General 2 10-24-2002 07:46 PM
Why Won't Apache and MySQL Start on Boot? John_Saunders Linux - Newbie 1 07-17-2002 12:23 AM

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

All times are GMT -5. The time now is 02:00 PM.

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