Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
02-23-2010, 10:45 AM
|
#1
|
LQ Newbie
Registered: Jan 2010
Posts: 18
Rep:
|
Problem changing mysql uid,gid: mysql start fails
Dear all,
first of all I'm not sure whether this is the right section where to post this question. I'm not exactly a newbie in terms of linux, but I really have no clue, so I feel like being a newbie.
I need to move /var/lib/mysql directory because of space problems: the original location is a virtual machine and the new location is a directory nfs-mounted on the virtual machine (this just to explain why I want to change mysql uid/gid). Since this way the destination is a directory shared by two hosts I need first of all to make mysql uid and gid uniform in the two (the uniform uid/gid is a problem that I faced already in this kind of sharing, this is why I assume it's the firts thing to do).
I did the following
Code:
/etc/init.d/mysql stop
usermod -u xxx mysql
groupmod -g yyy mysql
The problem is that when I try to restart mysql it fails. Restoring the original uid/gid mysql starts without any problem.
If there's somebody that can give me a hint... I really have no idea!
Thank you in advance
|
|
|
02-23-2010, 11:51 AM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
I'll start with a question:
Why the usermod/groupmod commands? What are you trying to
achieve?
|
|
|
02-23-2010, 03:43 PM
|
#3
|
LQ Newbie
Registered: Jan 2010
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by Tinkster
I'll start with a question:
Why the usermod/groupmod commands? What are you trying to
achieve?
|
I want to move /var/lib/mysql in /some/directory/mysql
The first is in a virtual machine (running in a certain other machine), the second is a directory in the host of the VM and mounted in the virtual machine.
When I first mounted let's say /some/directory in the VM, I started to have huge problems with permissions (when reading/writing files in the mounted dir) and this was due to the fact that the users were not well mapped between guest and host. I solved the problem making uniform uid and gid in the VM (guest) and in the host (since in the beginning they were different).
I assume mysql would have the same problems, this is why I imagine this is the first thing to take care of (before even try to move /var/lib/mysql).
|
|
|
02-23-2010, 06:18 PM
|
#4
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
So ... what's the host OS, how is the drive shared,
and what is the current UID & GID on it? Realistically
you should just have to make sure all relevant files &
dirs (this includes config, logging, run etc) have the
corret (identical) owner.
|
|
|
02-24-2010, 08:25 AM
|
#5
|
LQ Newbie
Registered: Jan 2010
Posts: 18
Original Poster
Rep:
|
Well,
* the host OS is a RedHat (the guest is debian)
* the 'shared' directory is actually an nfs mount on the virtual-debian (I don't know if this is a satisfactory reply)
* on the RedHat host "id mysql" gives uid=505 and gid=505 [..] (in the debian guest uid=104 and gid=107 [..])
Quote:
Realistically
you should just have to make sure all relevant files &
dirs (this includes config, logging, run etc) have the
corret (identical) owner.
|
I don't understand exactly this part: in principle doing groupmod and usermod in the debian guest I am just "changing the numbers". So why do I already have problems in starting mysql without moving anything? What am I missing?
BTW: thank you very much for the attention and the help!
|
|
|
02-24-2010, 08:39 AM
|
#6
|
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
|
I'd say that after you changed the gid and uid they don't match whats on the filesystem itself.
An Example to explain what I mean
Before change of id's
mysql gid: 100
mysql uid: 100
files owned by mysql: uid:100 gid:100
After change of id's
mysql gid: 200
mysql uid: 200
files owned by mysql: uid:100 gid:100
So when you start mysql it comes along with 200/200 but the files are only allowed to be used by 100/100. Just because ls shows ownage by mysql before does not mean they are owned by mysql after change. (specialy because ls just converts gid/uid into names. Internaly it just goes with numbers)
But before chowning the files on the new space. Make sure that the new mysql owner is allowed to write on the new space.
|
|
|
02-24-2010, 09:04 AM
|
#7
|
LQ Newbie
Registered: Jan 2010
Posts: 18
Original Poster
Rep:
|
Quote:
Originally Posted by zhjim
Just because ls shows ownage by mysql before does not mean they are owned by mysql after change. (specialy because ls just converts gid/uid into names. Internaly it just goes with numbers)
But before chowning the files on the new space. Make sure that the new mysql owner is allowed to write on the new space.
|
Ok, thanks. This is probably exactly what I'm missing: using "ls -ln" instead of "ll" appears evident that while the owner of the files is automatically changed after usermod the group keeps being the old one also after the groupmod (I'm not too expert, this is a little bit funny, no?).
So the idea is that now I have to fish all the files of the group mysql and chsomething them?
|
|
|
02-25-2010, 01:38 AM
|
#8
|
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
|
Quote:
Originally Posted by gjatute
Ok, thanks. This is probably exactly what I'm missing: using "ls -ln" instead of "ll" appears evident that while the owner of the files is automatically changed after usermod the group keeps being the old one also after the groupmod (I'm not too expert, this is a little bit funny, no?).
|
I doubt that the owner changes automatically. I'd say that it just happens to be the same uid on both servers... But then there would be no need to usermod and change the uid.
Quote:
Originally Posted by gjatute
So the idea is that now I have to fish all the files of the group mysql and chsomething them?
|
The command your looking for is chown
But like I sad first make sure that the new mysql user can write on the NFS share. After that you can chown the directory and all the files inside the new mysql_data_dir.
|
|
|
All times are GMT -5. The time now is 12:19 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|