Skip to content

Commit 0176b2c

Browse files
Fix innodb non root restart issue (#38)
Signed-off-by: Ashraful Haque Tani <[email protected]>
1 parent 8c5b1bc commit 0176b2c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/run_innodb.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function create_replication_user() {
101101
retry 120 ${mysql} -N -e "GRANT ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, EXECUTE, INDEX, INSERT, LOCK TABLES, REFERENCES, SHOW VIEW, TRIGGER, UPDATE ON mysql_innodb_cluster_metadata_previous.* TO 'repl'@'%' WITH GRANT OPTION;"
102102
retry 120 ${mysql} -N -e "GRANT CLONE_ADMIN, BACKUP_ADMIN, CONNECTION_ADMIN, EXECUTE, GROUP_REPLICATION_ADMIN, PERSIST_RO_VARIABLES_ADMIN, REPLICATION_APPLIER, REPLICATION_SLAVE_ADMIN, ROLE_ADMIN, SYSTEM_VARIABLES_ADMIN ON *.* TO 'repl'@'%' WITH GRANT OPTION;"
103103
#mysql-server docker image doesn't has the user root that can connect from any host
104-
retry 120 ${mysql} -N -e "CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';"
104+
retry 10 ${mysql} -N -e "CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}';"
105105
retry 120 ${mysql} -N -e "GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;"
106106
retry 120 ${mysql} -N -e "FLUSH PRIVILEGES;"
107107
retry 120 ${mysql} -N -e "SET SQL_LOG_BIN=1;"
@@ -125,11 +125,14 @@ function configure_instance() {
125125
return
126126
fi
127127

128-
retry 30 ${mysqlshell} -e "dba.configureInstance('${replication_user}@${report_host}',{password:'${MYSQL_ROOT_PASSWORD}',interactive:false,restart:true});"
128+
retry 30 ${mysqlshell} -e "dba.configureInstance('${replication_user}@${report_host}',{password:'${MYSQL_ROOT_PASSWORD}',interactive:false,restart:false});"
129129
#instance need to restart after configuration
130130
# Prevent creation of new process until this one is finished
131131
#https://serverfault.com/questions/477448/mysql-keeps-crashing-innodb-unable-to-lock-ibdata1-error-11
132132
#The most common cause of this problem is trying to start MySQL when it is already running.
133+
134+
#for non-root users, set the restart flag to false, stop the mysqld process, set restart_required=1 to start the process
135+
mysqladmin -u ${MYSQL_ROOT_USERNAME} -hlocalhost -p${MYSQL_ROOT_PASSWORD} --port=3306 shutdown
133136
wait $pid
134137
restart_required=1
135138
}

0 commit comments

Comments
 (0)