X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;f=mysql.init;h=120f67bb233805a6455f255432c1aeea540da90d;hb=c19cb93d317031f20d6a3e3899d93d014a929a66;hp=9f0867e23fd32de0f255c90e4665119e56e2c3b9;hpb=694a046dffb31954243b70f66ad1928055fe7bdf;p=packages%2Fmysql.git diff --git a/mysql.init b/mysql.init index 9f0867e..120f67b 100755 --- a/mysql.init +++ b/mysql.init @@ -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,13 +489,14 @@ 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 @@ -503,17 +504,33 @@ mysqlinit() { 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: -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 & @@ -535,15 +552,15 @@ also try to start the mysqld daemon with: You can use the command line tool mysql to connect to the mysql database and look at the grant tables: -shell> mysql -u root mysql +shell> mysql -u mysql mysql 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. +Please check PLD Linux ftp site for newer versions of this package. Please consult the MySQL manual section: 'Problems running mysql_install_db', and the manual section that describes problems on