SOURCES: mysql.init - detect if mysql tables creation fails by che...

glen glen at pld-linux.org
Thu Mar 8 16:19:07 CET 2007


Author: glen                         Date: Thu Mar  8 15:19:07 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- detect if mysql tables creation fails by checking mysql.host table and leave mysql-init.sql on disk for later inspection

---- Files affected:
SOURCES:
   mysql.init (1.108 -> 1.109) 

---- Diffs:

================================================================
Index: SOURCES/mysql.init
diff -u SOURCES/mysql.init:1.108 SOURCES/mysql.init:1.109
--- SOURCES/mysql.init:1.108	Thu Mar  8 15:45:10 2007
+++ SOURCES/mysql.init	Thu Mar  8 16:19:01 2007
@@ -390,16 +390,20 @@
 	    ln -s "$sock" /var/lib/mysql/mysql.sock
 	fi
 
-	if /usr/sbin/mysqld --bootstrap --skip-grant-tables \
-	    --datadir=$MYSQL_DATA_DIR --user=$MYSQL_USER << END_OF_DATA
-
+	cat > $MYSQL_DATA_DIR/mysql-init.sql <<-EOF
 		CREATE DATABASE mysql;
 		use mysql;
 		$(sed -e "s, at ENGINE@,$BASE_TABLETYPE," /usr/share/mysql/init_db.sql)
 		$(sed -e "s,\$hostname,$hostname,g" /usr/share/mysql/init_db-data.sql)
-END_OF_DATA
+		"
+EOF
 
-	then
+	ok=0
+	/usr/sbin/mysqld --bootstrap --skip-grant-tables \
+		--datadir=$MYSQL_DATA_DIR --user=$MYSQL_USER < $MYSQL_DATA_DIR/mysql-init.sql && ok=1
+	[ -f $MYSQL_DATA_DIR/mysql/user.frm ] || ok=0
+	if [ "$ok" = 1 ]; then
+		rm -f $MYSQL_DATA_DIR/mysql-init.sql
 	    ok
 	cat << END_OF_MSG
 
@@ -422,8 +426,8 @@
 	    cat << END_OF_MSG
 Installation of grant tables FAILED!
 
-Examine the logs in $MYSQL_DATA_DIR for more information.  You can
-also try to start the mysqld demon with:
+Examine the logs in /var/log/mysql for more information.  You can
+also try to start the mysqld daemon with:
 
 /usr/sbin/mysqld --skip-grant &
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/mysql.init?r1=1.108&r2=1.109&f=u



More information about the pld-cvs-commit mailing list