Bug 28849 - mysql init script tweek
mysql init script tweek
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: mysql (Show other bugs)
7.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Patrick Macdonald
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-02-22 09:27 EST by chrismcc
Modified: 2007-04-18 12:31 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description chrismcc 2001-02-22 09:27:54 EST
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 12:24:35 EST
It shouldn't create that directory - it's owned by the mysql-server package.
Comment 2 chrismcc 2001-02-23 20:25:42 EST
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@pricegrabber.com




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