--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
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"
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
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
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)
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 &
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.