This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 173618 - Mysql don't initialize if datadir is another place that /var/lib/mysql
Mysql don't initialize if datadir is another place that /var/lib/mysql
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: mysql (Show other bugs)
4
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-18 13:04 EST by Volnei
Modified: 2013-07-02 23:07 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-23 09:22:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Volnei 2005-11-18 13:04:47 EST
Description of problem:

If I change datadir parameter in /etc/my.cnf file to another place that 
/var/lib/mysql, the mysql don't initialize.

The problem is in init.d/mysqld script I try initialize mysql via older
scripts and it was started with success.
Then I'm using mysqld script from tarball from MySQLAB packet.

Version-Release number of selected component (if applicable):

FC4
mysql-devel-4.1.14-1.FC4.1
mysqlclient10-3.23.58-6
mysql-4.1.14-1.FC4.1
mysql-server-4.1.14-1.FC4.1


How reproducible:

1. Create a directory, eg. /mysql and make a chown mysql:mysql /mysql
2. Move /var/lib/mysql to /var/lib/mysql.old
3. Create a symlink. eg ln -sf /mysql /var/lib/mysql
4. After change the references into /etc/my.cnf to /mysql.
5. Try start the mysql

example: datadir=/var/lib/mysql change to /mysql

 
Actual results:

051118 14:21:54  mysqld started
051118 14:21:54 [Warning] Can't create test file /var/lib/mysql/lab.lower-test
^G/usr/libexec/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
051118 14:21:54 [ERROR] Aborting

Expected results:
Normal startup

eg:
051118 15:38:59  mysqld started
051118 15:39:00  InnoDB: Started; log sequence number 0 43634
/usr/libexec/mysqld: ready for connections.
Version: '4.1.14'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source
distribution
Comment 1 Tom Lane 2005-11-18 13:27:52 EST
Are you running with SELinux enforcement enabled (see /usr/sbin/getenforce)?
If so, I believe the default security policy constrains the mysql daemon to
write only under /var/lib/mysql.  To move the database somewhere else, you'd
need to adjust the security policy.

You could check whether this is the problem by seeing if mysql will start after
doing "sudo /usr/sbin/setenforce 0".
Comment 2 Volnei 2005-11-23 05:13:24 EST
Yes, the SELinux was responsable to my 'problem'. 
I correct the policy and the mysql are work now.

Thanks.
Comment 3 Tom Lane 2005-11-23 09:22:38 EST
OK, closing this report as not-a-bug then.  Thanks for letting me know.

Note You need to log in before you can comment on or make changes to this bug.