]> TLD Linux GIT Repositories - packages/mysql.git/blobdiff - mysql.init
- Percona 5.7 is no longer available, MySQL 5.7 from PLD
[packages/mysql.git] / mysql.init
index 5337ee4e40c7a4d16aa07f818d45efeac43449c9..c55f9ef0c5c3acf823df7fb8d32e3d637a6fd6df 100755 (executable)
@@ -294,7 +294,7 @@ mysqlstart() {
                        --datadir=$MYSQL_DATA_DIR \
                        --pid-file=$MYSQL_PIDFILE \
                        ${MYSQL_LOG_ERROR:+--log-error="$MYSQL_LOG_ERROR"} \
-                       $MYSQL_OPTIONS 2>/dev/null &
+                       $MYSQL_OPTIONS &
        pid=$!
 
        sleep 0.1
@@ -445,7 +445,7 @@ mysqlinit() {
        if [ -f "$clusterdir/mysqld.conf" ]; then
                mysqlgetconfig "$clusterdir"
        else
-               MYSQL_USER="mysql"
+               MYSQL_USER="root"
                MYSQL_CLUSTER_DIR="$clusterdir"
                MYSQL_DATA_DIR="$clusterdir/mysqldb/db"
                MYSQL_PIDFILE="$clusterdir/mysqldb/mysql.pid"
@@ -455,7 +455,7 @@ mysqlinit() {
                MYSQL_CONFIG="$MYSQL_CLUSTER_DIR/mysqld.conf"
        fi
 
-       show "Initializing MySQL cluster %s" "$clusterdir"; started
+       show "Initializing cluster %s" "$clusterdir"; started
 
        # Check if not exist init database
        if [ -d "$MYSQL_DATA_DIR/mysql" ]; then
@@ -465,7 +465,7 @@ mysqlinit() {
                exit 6
        fi
 
-       show "Installing MySQL system tables for $MYSQL_DATA_DIR"
+       show "Initializing MySQL database for $MYSQL_DATA_DIR"
        busy
        TMP=/tmp TMPDIR=/tmp
 
@@ -489,31 +489,48 @@ mysqlinit() {
        ok=0
        /usr/sbin/mysqld \
                --defaults-file=$MYSQL_CLUSTER_DIR/mysqld.conf \
-               --initialize-insecure \
+               --initialize \
                --skip-grant-tables \
                --datadir=$MYSQL_DATA_DIR \
                --user=$MYSQL_USER \
                --slave-load-tmpdir=$MYSQL_DATA_DIR \
                --tmpdir=$MYSQL_DATA_DIR \
-               --log-error=$MYSQL_ERRLOG && ok=1
+               --log-error=$MYSQL_ERRLOG \
+               && ok=1
        [ -f $MYSQL_DATA_DIR/mysql/user.frm ] || ok=0
 
        if [ "$ok" = 1 ]; then
                ok
                cat << END_OF_MSG
 
-PLEASE REMEMBER TO SET A PASSWORD FOR THE mysql USERS!
-This is done, after starting database, in the order shown below,
-with:
+PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL USERS!
 
-Add 'mysql_sysadmin' user (RELOAD and SHUTDOWN privileges):
-echo "CREATE USER 'mysql_sysadmin'@'localhost' IDENTIFIED BY 'SOME_RANDOM_PASSWORD'; FLUSH PRIVILEGES;" | mysql --ssl-mode=DISABLED -u root -S $MYSQL_SOCKET
-echo "GRANT RELOAD, SHUTDOWN ON *.* TO 'mysql_sysadmin'@'localhost'; FLUSH PRIVILEGES;" | mysql --ssl-mode=DISABLED -u root -S $MYSQL_SOCKET
+Start database:
+$ service mysql start
 
-Set password for root user (ALL privileges, DB admin):
-echo "ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword'; FLUSH PRIVILEGES;" | mysql --ssl-mode=DISABLED -u root -S $MYSQL_SOCKET
+and set passwords:
 
-NOTE: mysql_sysadmin password should be placed to $MYSQL_CONFIG in
+For 'root' user (ALL privileges, DB admin), paste command with new password:
+ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';
+FLUSH PRIVILEGES;
+
+For 'mysql_sysadmin' (RELOAD and SHUTDOWN privileges):
+CREATE USER 'mysql_sysadmin'@'localhost' IDENTIFIED BY 'sysnewpassword' PASSWORD EXPIRE NEVER;
+GRANT RELOAD, SHUTDOWN ON *.* TO 'mysql_sysadmin'@'localhost';
+FLUSH PRIVILEGES;
+
+
+Both into command:
+$ mysql -u root -p --ssl-mode=disabled -S $MYSQL_SOCKET
+
+NOTE 1:
+CURRENT TEMPORARY ROOT PASSWORD CAN BE FOUND IN LOG
+(grep for "A temporary password is generated" string):
+$MYSQL_ERRLOG
+
+
+NOTE 2:
+mysql_sysadmin password should be placed to $MYSQL_CONFIG in
 mysqladmin section. See the manual for more instructions.
 (This user is used at logs rotation and server shutdown)
 
@@ -523,11 +540,11 @@ END_OF_MSG
                cat << END_OF_MSG
 ERROR:
 ERROR:
-ERROR: Initialization of server FAILED!
+ERROR: Installation FAILED!
 ERROR:
 ERROR:
 
-Examine the logs in /var/log/mysql for more information. You can
+Examine the logs in $MYSQL_ERRLOG for more information. You can
 also try to start the mysqld daemon with:
 
 /usr/sbin/mysqld --skip-grant &
@@ -541,7 +558,7 @@ mysql> show tables
 Try 'mysqld --help' if you have problems with paths. Setting on
 logging in $MYSQL_DATA_DIR/mysqld.conf gives you a log in /var/log/mysql/query.log that
 may be helpful. The latest information about MySQL is available on the
-web at https://www.percona.com/software/mysql-database/mysql.
+web at http://www.mysql.com/.
 
 Please check TLD Linux ftp site for newer versions of this package.