--- /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
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
It shouldn't create that directory - it's owned by the mysql-server package.
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 firstname.lastname@example.org