Bug #40526 mysql Fails to Start
Submitted: 5 Nov 2008 12:27 Modified: 3 Mar 2010 8:16
Reporter: leo joe Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Errors Severity:S1 (Critical)
Version:5.0.45-7.el5 OS:Linux (Cent os 5)
Assigned to: CPU Architecture:Any
Tags: Mysql Fails to Start

[5 Nov 2008 12:27] leo joe
Description:

While starting mysql it fails

In Log file I am getting like this 

081105 17:50:09  mysqld started
081105 17:50:09 [Warning] The syntax for replication startup options is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
081105 17:50:09 [Warning] Can't create test file /mnt/mysql/data/mysql02.lower-test
081105 17:50:09 [Warning] Can't create test file /mnt/mysql/data/mysql02.lower-test
^G/usr/libexec/mysqld: Can't change dir to '/mnt/mysql/data/' (Errcode: 13)
081105 17:50:09 [ERROR] Aborting

081105 17:50:09 [Note] /usr/libexec/mysqld: Shutdown complete

081105 17:50:09  mysqld ended

How to repeat:
Reply to this post

Suggested fix:
Welcome
[6 Nov 2008 5:14] Valeriy Kravchuk
Please, send the results of:

ls -l /mnt/mysql
df -k
mount

and your my.cnf file content.
[7 Nov 2008 4:54] leo joe
Thanks for you reply

ls -l /mnt/mysql
================

drwx------ 2 root root     4096 Nov  6 15:45 mysql

df -k
======

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hdd2             39674224   3986372  33639968  11% /
/dev/hdd1               194442     16230    168173   9% /boot
tmpfs                   257236         0    257236   0% /dev/shm

mount
======

/dev/hdd2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/hdd1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

============================================================================

Mysql (Primary server)

vi /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
#datadir=/opt/mysql

#socket=/opt/mysql/mysql.sock
socket=/var/lib/mysql/mysql.sock

server-id=1

auto-increment-increment = 2
auto-increment-offset = 1

master-host = 192.168.1.35
master-user = root
master-password = password
master-port = 3306

log-bin=/var/log/mysql/mysql #information for becoming master added
binlog-do-db=zestadz_development
replicate-do-db=zestadz_development

[mysql.server]
user=mysql
basedir=/var/lib

#relay-log = /var/lib/mysql/slave-relay.log
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

==================================================================================

Mysql (secondary server)

vi /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
#datadir=/mnt/mysql/data
socket=/var/lib/mysql/mysql.sock
server-id=2

auto-increment-increment = 2
auto-increment-offset = 2

master-host = 192.168.1.34
master-user = root
master-password = password
master-port = 3306

log-bin=/var/log/mysql/mysql #information for becoming master added
binlog-do-db=zestadz_development
replicate-do-db=zestadz_development
#relay-log=/var/run/mysqld/mysqld-relay-bin

[mysql.server]
user=mysql
basedir=/var/lib

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

==================================================================================
[7 Nov 2008 5:29] Valeriy Kravchuk
I do not understand why /mnt/mysql is accessed at all with the my.cnf you posted (maybe you commented out datadir pointing there later), but no other Linux user but root can access this directory. Do you start MySQL server as root?
[7 Nov 2008 6:13] leo joe
previously i used datadir as /mnt/mysql
now i am using default data directory

if i change some other directory mysql fails to start
[7 Nov 2008 7:30] Valeriy Kravchuk
OK, so it works with the default datadir and does NOT work with any other, right? Now let me repeat my question: do you start server as root Linux user? 

If you don't you should set proper ownership and access rights for the datadir. Read http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html for the details.
[7 Nov 2008 8:36] leo joe
yes it works with the default datadir and does NOT work with any
other.
i started mysql from root user.
i set permission and ownership but it fails to start.

Let me explain what i did

I copied mysql from /var/lib/mysql to /mnt/mysql/data
and changed the data directory to (datadir=/mnt/mysql/data)im my.cnf file and changed mysql directory permission and ownership (chmod 755 -R /mnt/mysql) (chown mysql:mysql -R /mnt/mysql) and started mysql from root user, but it fails
[21 Nov 2008 9:43] Sveta Smirnova
Thank you for the feedback.

Please provide command you use to start mysqld as root. Also, please, chown /mnt/mysql so it belongs to user you use in --user option and provide ouput of ls -lR /mnt/mysql.
[22 Dec 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[20 Jan 2010 17:35] Kevin K
Hey,

Also having this issue. The steps to re-create it are simple.

mount -t tmpfs -o size=1G,mode=0777 tmpfs /ramdisk/
mkdir /ramdisk/mysql
chown mysql:mysql /ramdisk/mysql

service mysqld start
[FAILED]

100120 12:33:05 [Warning] Can't create test file /ramdisk/mysql/test.lower-test
[3 Feb 2010 8:16] Sveta Smirnova
Kevin K,

thank you for the feedback. Have you installed system tables before starting MySQL server?
[4 Mar 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".