summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-04-01 13:53:27 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-04-02 13:48:59 +0200
commit930563ce0d47dfb80b8298df883030bd3694198b (patch)
treed7c54e30bf29ebd4c220c657b07a59891539836d
parent6a68c4cbb3943263961aee0da6916f92f25e666a (diff)
#941 Set MySQL encoding to UTF-8
This commit sets the MySQL enconding to UTF8. This way we can avoid problems with special characters in strings, like: ó. It also changes the installation script to always copy the MySQL configuration template and restart MySQL. So, even if the server had MySQL installed before the OpenGnsys installation, the script configures MySQL. Example error that this commit should fix: ogAdmServer[12524]: failed to query database (actualizaSoftware:2380) 1366: Incorrect string value: '\xF3n de ...' for column 'descripcion' at row 1 The encoding configuration before this commit should be like this: mysql> SHOW VARIABLES LIKE 'char%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.10 sec) The encoding configuration after this commit should be like this: mysql> SHOW VARIABLES LIKE 'char%'; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.01 sec)
-rwxr-xr-xinstaller/opengnsys_installer.sh23
-rw-r--r--server/etc/mysqld-og.cnf3
2 files changed, 14 insertions, 12 deletions
diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh
index 04807ec4..529f4d43 100755
--- a/installer/opengnsys_installer.sh
+++ b/installer/opengnsys_installer.sh
@@ -1745,17 +1745,6 @@ INSTVERSION=$(jq -r '.version' $INSTALL_TARGET/doc/VERSION.json)
# Instalar base de datos de OpenGnsys Admin.
isInArray notinstalled "mysql-server" || isInArray notinstalled "mariadb-server"
if [ $? -eq 0 ]; then
- # Copiar plantilla de configuración de MySQL.
- cp $WORKDIR/opengnsys/server/etc/mysqld-og.cnf $MYSQLCFGDIR 2>/dev/null
- # Habilitar gestor de base de datos (MySQL, si falla, MariaDB).
- service=$MYSQLSERV
- $ENABLESERVICE
- if [ $? != 0 ]; then
- service=$MARIADBSERV
- $ENABLESERVICE
- fi
- # Activar gestor de base de datos.
- $STARTSERVICE
# Asignar clave del usuario "root".
mysqlSetRootPassword "${MYSQL_ROOT_PASSWORD}"
else
@@ -1763,6 +1752,18 @@ else
mysqlGetRootPassword
fi
+# Copy MySQL configuration template
+cp $WORKDIR/opengnsys/server/etc/mysqld-og.cnf $MYSQLCFGDIR 2>/dev/null
+# Enable database manager (MySQL, if missing, MariaDB).
+service=$MYSQLSERV
+$ENABLESERVICE
+if [ $? != 0 ]; then
+ service=$MARIADBSERV
+ $ENABLESERVICE
+fi
+# Activar gestor de base de datos.
+$STARTSERVICE
+
mysqlTestConnection "${MYSQL_ROOT_PASSWORD}"
if [ $? -ne 0 ]; then
errorAndLog "Error while connection to mysql"
diff --git a/server/etc/mysqld-og.cnf b/server/etc/mysqld-og.cnf
index b7ea14c0..36641c65 100644
--- a/server/etc/mysqld-og.cnf
+++ b/server/etc/mysqld-og.cnf
@@ -1,3 +1,4 @@
[mysqld]
event_scheduler = ON
-
+character-set-server=utf8
+collation-server=utf8_general_ci