@@ -101,7 +101,7 @@ function create_replication_user() {
101
101
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;"
102
102
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;"
103
103
# 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} ';"
105
105
retry 120 ${mysql} -N -e " GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION;"
106
106
retry 120 ${mysql} -N -e " FLUSH PRIVILEGES;"
107
107
retry 120 ${mysql} -N -e " SET SQL_LOG_BIN=1;"
@@ -125,11 +125,14 @@ function configure_instance() {
125
125
return
126
126
fi
127
127
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 });"
129
129
# instance need to restart after configuration
130
130
# Prevent creation of new process until this one is finished
131
131
# https://serverfault.com/questions/477448/mysql-keeps-crashing-innodb-unable-to-lock-ibdata1-error-11
132
132
# 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
133
136
wait $pid
134
137
restart_required=1
135
138
}
0 commit comments