Bug 28849 - mysql init script tweek
Summary: mysql init script tweek
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mysql
Version: 7.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Patrick Macdonald
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
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:
Clone Of:
Environment:
Last Closed: 2001-02-22 17:24:39 UTC
Embargoed:


Attachments (Terms of Use)

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

--- /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
 	    ret=$?
+            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
/var/lib/mysql/mysql.sock

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.

IMHO
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






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