Browse code

Merge "Make database code work with mysql8"

Zuul authored on 2020/03/20 23:26:50
Showing 1 changed files
... ...
@@ -109,8 +109,10 @@ function configure_database_mysql {
109 109
         sudo mysql $cmd_args -e "UPDATE mysql.user SET plugin='' WHERE user='$DATABASE_USER' AND host='localhost';"
110 110
         sudo mysql $cmd_args -e "FLUSH PRIVILEGES;"
111 111
     fi
112
+    # Create DB user if it does not already exist
113
+    sudo mysql $cmd_args -e "CREATE USER IF NOT EXISTS '$DATABASE_USER'@'%' identified by '$DATABASE_PASSWORD';"
112 114
     # Update the DB to give user '$DATABASE_USER'@'%' full control of the all databases:
113
-    sudo mysql $cmd_args -e "GRANT ALL PRIVILEGES ON *.* TO '$DATABASE_USER'@'%' identified by '$DATABASE_PASSWORD';"
115
+    sudo mysql $cmd_args -e "GRANT ALL PRIVILEGES ON *.* TO '$DATABASE_USER'@'%';"
114 116
 
115 117
     # Now update ``my.cnf`` for some local needs and restart the mysql service
116 118
 
... ...
@@ -120,8 +122,6 @@ function configure_database_mysql {
120 120
     iniset -sudo $my_conf mysqld sql_mode TRADITIONAL
121 121
     iniset -sudo $my_conf mysqld default-storage-engine InnoDB
122 122
     iniset -sudo $my_conf mysqld max_connections 1024
123
-    iniset -sudo $my_conf mysqld query_cache_type OFF
124
-    iniset -sudo $my_conf mysqld query_cache_size 0
125 123
 
126 124
     if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then
127 125
         echo_summary "Enabling MySQL query logging"