host parameter of mysql_real_connect (and corresponding configuration
settings MYSQL_OPT_HOST for mysql_options() api call and host key in
configuration files) now accepts to specify multiple hosts and ports.
When establishing a connection, the list of specified hosts is run
through until a connection can be established. If no connection
can be established to any of the specified hosts, an error is returned.
Specifications for multiple hosts/ports:
- hostname and port must be seperated by a colon (:)
- IPv6 addresses must be enclosed within square brackets
- hostname:port pairs must be be seperated by a comma (,)
- if only one host:port was specified, the host string needs to end
with a comma.
- if no port was specified, the default port will be used.
Examples for failover host string:
host=[::1]:3306,192.168.0.1:3306,test.example.com
host=localhost:3306,
A connection string contains key/value pairs, separated by a semicolon
as used in ODBC. Supported keys are all configuration options which can
be used in MariaDB configuration files. For a complete list check
https://github.com/mariadb-corporation/mariadb-connector-c/wiki/config_files#configuration-options.
The connection string must contain at least one semicolon, otherwise
it wil be interpreted as hostname. Unknown or invalid keys will be ignored.
To connect via connection string, the following methods might be used:
- by specifing connection option in configuration file:
connection=host=localhost;ssl_enforce=1;
- by using mariadb_connect() macro
mariadb_connect(mysql, "host=localhost;ssl_enforce=1")
- by passing connection string in host parameter to mysql_real_connect
mysql_real_connect(mysql, "host=localhost;ssl_enforce=1", NULL, NULL, NULL, 0, NULL, 0)
Added new option MARIADB_OPT_RESTRICTED_AUTH (and corresponding
"restricted-auth" option for configuration files) which specifies
on or more comma spearated authentication plugins which are allowed
for authenication.
If the server asks for an authentication plugin not listed in this
option the connect attempt will fail with error CR_PLUGIN_NOT_ALLOWED.
travis: use connector-test-machine test script that permit to run the following tests :
* MariaDB all supported version
* Maxscale
* MySQL
* SkySQL
If CONNECTOR_TEST_SECRET_KEY is not provided (PR) only MariaDB and MySQL community will be test
Pull request testing correction
appveyor correction using archive if not latest server release
This patch is made as a part of MDEV-8334 to fix failing test in unit and
main test suite so that utf8mb3 characterset is recognized. Failing tests:
main.mysql_client_test
main.mysql_client_test_comp
unit.conc_basic-t
unit.conc_charset
unit.conc_connection
If no default authentication plugin was specified and the server sends preferred
authentication method in server hello package client now uses servers preferred
authentication method instead of using mysql_native_password. If no default
authentication plugin was specified and the server didn't send an
authenticatoin method client uses the default mysql_native_password plugin.
Tests configured for windows and ubuntu 18.04
Tests with simple password are changed for more complex password to
satisfy possible complex password requirement.
Fixed crash when server sent session tracking information with session type
SESSION_TRACK_STATE_CHANGE. In this special case the packet doesn't contain
the overall length. (see https://mariadb.com/kb/en/library/ok_packet/).
mysql_change_user doesn't reset server status
Fixed my_auth.c, after successful connect the server status package information (including session change information) must be updated.
latin1, which is also default behavior in MariaDB 10.1
To use another default character set, MariaDB Connector/C has to be build
with CMake parameter -DDEFAUT_CHARSET=name.