Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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?
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
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.
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...
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
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.
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.
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
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by secretlydead
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.