# -*- text -*-
#
-# SQL driver configuration for MySQL
+# SQL driver configuration for MySQL/MariaDB
#
# Should be included inside of a SQL module's configuration section
#
# cipher = "DHE-RSA-AES256-SHA:AES128-SHA"
# }
#
- # If yes, (or auto and libmysqlclient reports warnings are
+ # If yes, (or auto and libmariadb reports warnings are
# available), will retrieve and log additional warnings from
# the server if an error has occurred. Defaults to 'auto'
warnings = auto
+
+ # The character set to use for connections
+ # See https://mariadb.com/kb/en/mysql_set_character_set/
+ # for a list of valid options
+# character_set = utf8mb4
}
#######################################################################
# Connection config
#######################################################################
-# The character set is not configurable. The default character set of
-# the mysql client library is used. To control the character set,
-# create/edit my.cnf (typically in /etc/mysql/my.cnf or /etc/my.cnf)
-# and enter
-# [client]
-# default-character-set = utf8
+# The character set is configured using the driver option `character_set`
+# in mods-config/sql/driver/mysql
+#
+# To control other client library options, create / edit my.cnf (typically
+# in /etc/mysql/my.cnf or /etc/my.cnf) and enter
+# [freeradius]
+# <option> = <value>
#
#######################################################################
char const *warnings_str; //!< Whether we always query the server for additional warnings.
rlm_sql_mysql_warnings warnings; //!< mysql_warning_count() doesn't
//!< appear to work with NDB cluster
+
+ char const *character_set; //!< Character set to use on connections.
} rlm_sql_mysql_t;
static conf_parser_t tls_config[] = {
{ FR_CONF_POINTER("tls", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) tls_config },
{ FR_CONF_OFFSET("warnings", rlm_sql_mysql_t, warnings_str), .dflt = "auto" },
+ { FR_CONF_OFFSET("character_set", rlm_sql_mysql_t, character_set) },
CONF_PARSER_TERMINATOR
};
mysql_options(&(c->db), MYSQL_READ_DEFAULT_GROUP, "freeradius");
+ if (inst->character_set) mysql_options(&(c->db), MYSQL_SET_CHARSET_NAME, inst->character_set);
+
/*
* We need to know about connection errors, and are capable
* of reconnecting automatically.