PDA

View Full Version : Mysql / Ownership (wrong)



Zoner
10-17-2007, 03:40 AM
Hi,

when install MYSQL with custombuild, it not change to right ownership for directories:

Da with Mysql 4.0:



lrwxrwxrwx 1 mysql mysql 11 Oct 15 08:59 data -> /home/mysql
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 lib
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 bin
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 include
drwxr-xr-x 6 root mysql 4096 Feb 13 2005 mysql-test
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 scripts
drwxr-xr-x 3 root mysql 4096 Feb 13 2005 share
drwxr-xr-x 5 root mysql 4096 Feb 13 2005 sql-bench
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 support-files
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 tests
drwxr-xr-x 2 root mysql 4096 Feb 13 2005 docs
drwxr-xr-x 3 root mysql 4096 Feb 13 2005 man
-rwxr-xr-x 1 root mysql 801 Feb 13 2005 configure
-rw-r--r-- 1 root mysql 19099 Feb 13 2005 COPYING
-rw-r--r-- 1 root mysql 5164 Feb 13 2005 EXCEPTIONS-CLIENT
-rw-r--r-- 1 root mysql 8369 Feb 13 2005 INSTALL-BINARY
-rw-r--r-- 1 root mysql 1937 Feb 12 2005 README

Da/custombuild with Mysql 5.0:


lrwxrwxrwx 1 root root 11 Oct 15 09:07 data -> /home/mysql
drwxr-xr-x 2 503 users 4096 Jul 7 21:48 bin
drwxr-xr-x 3 503 users 4096 Jul 7 21:48 include
drwxr-xr-x 2 503 users 4096 Jul 7 21:48 lib
drwxr-xr-x 9 503 users 4096 Jul 7 21:48 mysql-test
drwxr-xr-x 2 503 users 4096 Jul 7 21:48 scripts
drwxr-xr-x 5 503 users 4096 Jul 7 21:48 sql-bench
drwxr-xr-x 2 503 users 4096 Jul 7 21:48 support-files
drwxr-xr-x 3 503 users 4096 Jul 7 21:48 share
drwxr-xr-x 2 503 users 4096 Jul 7 21:48 tests
drwxr-xr-x 2 503 users 4096 Jul 7 21:48 docs
drwxr-xr-x 4 503 users 4096 Jul 7 21:48 man
-rwxr-xr-x 1 503 users 801 Jul 7 21:47 configure
-rw-r--r-- 1 503 users 8528 Jul 7 21:25 INSTALL-BINARY
-rw-r--r-- 1 503 users 5139 Jul 4 16:06 EXCEPTIONS-CLIENT
-rw-r--r-- 1 503 users 19071 Jul 4 16:06 COPYING
-rw-r--r-- 1 503 users 1410 Jul 4 16:05 README

nobaloney
10-19-2007, 05:47 PM
Are these both on the same server?

If on a different server, was the directory restored to the server running MySQL5?

On the server running MySQL5, is mysql run by username users or by username mysql?

Jeff

Zoner
10-22-2007, 05:16 AM
Are these both on the same server?

Yeah same server, or checked others too, this problem is all server (DA/Dedian 3.1/Mysql 5 custombuild)


If on a different server, was the directory restored to the server running MySQL5?

Not restored, just install or upgrading Mysql 4.x to Mysql 5.x with custombuild.


On the server running MySQL5, is mysql run by username users or by username mysql?

Mysql server running with mysql user, not users.


mysql 2984 0.0 0.4 35800 18064 ? S Oct19 0:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --pid-file=/usr/local/mysql/data/xxx.pid --skip-external-locking

nobaloney
10-22-2007, 10:27 AM
One of those things that can't happen but did?

For example, let's look at this line:

drwxr-xr-x 2 root mysql 4096 Feb 13 2005 lib
which shows that the directory is owned by user root and group mysql.

Then let's look at this line:

drwxr-xr-x 2 503 users 4096 Jul 7 21:48 bin
which shows that the directory is owned by user 503 and group users.

First question: why do we get a 503 as the user instead of a username? Because the directory is set to a user ID for which no name exists. (Unix and linux actually manage users and groups by number; the conversion to name is done by a lookup in the passwd and group files, and if no line exists for the user or group name the conversion is skipped and the number is left.)

And why group [i]users[/b] because that's the group the directory is set to.

Why these settings? That's probably a great question for Martynas.

Jeff

smtalk
10-22-2007, 10:48 AM
Maybe it's packed as 503:503 (as you know tar.gz saves the ownership of the files). You can email John with a request to execute "chown mysql:mysql ..." command after the "tar xzf .." command. :)

nobaloney
10-22-2007, 11:08 AM
Thanks Martynas; I should have thought of that ;) .

Jeff

DirectAdmin Support
10-28-2007, 11:34 AM
Added:
chown -R mysql:mysql /usr/local/mysqlafter the "cd mysql". I did the full path because if the mysql directoy doesn't exist for whatever reason, we wouldn't want to chown the entire /usr/local directory ;)

Anyway, give it a try now, let me know if it doesn't work.

John