Bug 28849 - mysql init script tweek
Summary: mysql init script tweek
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mysql   
(Show other bugs)
Version: 7.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Patrick Macdonald
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-02-22 14:27 UTC by chrismcc
Modified: 2007-04-18 16:31 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-02-22 17:24:39 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description chrismcc 2001-02-22 14:27:54 UTC

--- /etc/init.d/mysqld.rpmorig	Thu Feb 22 06:21:17 2001
+++ /etc/init.d/mysqld	Thu Feb 22 06:21:51 2001
@@ -28,6 +28,7 @@
 	if [ ! -d /var/lib/mysql/mysql ] ; then
 	    action $"Initializing MySQL database: " /usr/bin/mysql_install_db
+            chmod 755 /var/lib/mysql
 	    chown -R mysql.mysql /var/lib/mysql
 	    if [ $ret -ne 0 ] ; then
 	    	return $ret

If the init script makes the initial database directory and files, the
permisions on /var/lib/mysql end up being 700 and normal users can't get to

Comment 1 Trond Eivind Glomsrxd 2001-02-22 17:24:35 UTC
It shouldn't create that directory - it's owned by the mysql-server package.

Comment 2 chrismcc 2001-02-24 01:25:42 UTC
Yes, the /var/lib/mysql directory is owned by the mysql-server package.  And a
rpm install does create the correct 755 permissions on /var/lib/mysql

But this is what I did:
I was testing a program that needed to create some MySQL users, create a
database, and make some tables.  After the first run the script did this.  I
found some errors, fixed them, and ran the script again.  It errored out because
the database and tables already existed.  Since this was on a devel machine, the
easiest thing to to was:

service mysqld stop
rm -fv /var/lib/mysql
service mysqld start

The sysv startup script will automagically create a brand new mysql directory
structure and create the 'root' user.  Cool!

now my program script fails because /var/lib/mysql is owned by mysql.mysql
(correct), but the directory permissions are now 700 and not the install default
of 755.  It can't get to /var/lib/mysql/mysql.sock.

If the /etc/rc.d/init.d/mysqld script will create a structure if one doesn't
exist, it should also chmod 755 (rpm install default) the top level directory.

Note: my login email address went away yesterday, so I won't get any replies.

current is chrismcc@pricegrabber.com

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