Docs Menu
Docs Home
/
BI Connector
/

Connect from the MySQL Client

On this page

  • Connect from MySQL without Authentication or TLS/SSL
  • Connect from MySQL with Authentication
  • Connect from MySQL with Authentication and TLS/SSL

You can use the command-line MySQL client to connect to the MongoDB Connector for BI.

To connect to a mongosqld instance listening on the MySQL default port 3307, run the following command:

"C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
--protocol tcp --port 3307
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
--protocol tcp --port 3307
mysql --protocol tcp --port 3307
mysql --protocol tcp --port 3307

Install the C Authentication Plugin as described in C Authentication Plugin.

Important

The C Authentication plugin was developed against MySQL 5.7.X Community Edition (64-bit), and tested with MySQL 5.7.X Community Edition and the latest version of MongoDB Connector for BI. The plugin is not compatible with MySQL Server or Connector/ODBC driver version 8 and later.

The following example uses the C authentication plugin to connect to a mongosqld instance listening on port 3307 as user reportsUser. The MySQL shell prompts for the password after the command has been entered.

"C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
--user='reportsUser?source=admin' ^
--default-auth=mongosql_auth -p
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
--user='reportsUser?source=admin' ^
--default-auth=mongosql_auth -p

Note

This example assumes that the authentication plugin file mongosql_auth.so is located in the default MySQL plugin folder:

Platform
Default Location
32-bit Windows
C:\Program Files (x86)\MySQL\MySQL Server 5.7\lib\plugin
64-bit Windows
C:\Program Files\MySQL\MySQL Server 5.7\lib\plugin
mysql --user='reportsUser?source=admin' --default-auth=mongosql_auth -p

Note

This example assumes that the authentication plugin file mongosql_auth.so is located in the default MySQL plugin folder. The location of the plugin folder varies by platform, but you can locate it by running the following command:

mysql_config --plugindir

mysql_config.pl can find the plugin directory only on macOS and Linux hosts.

mysql --user='reportsUser?source=admin' --default-auth=mongosql_auth -p

Note

This example assumes that the authentication plugin file mongosql_auth.so is located in the default MySQL plugin folder. The location of the plugin folder varies by platform, but you can locate it by running the following command:

mysql_config --plugindir

mysql_config.pl can find the plugin directory only on macOS and Linux hosts.

For additional options, see the MySQL Commands.

Important

The binary distribution of MySQL Community uses the yaSSL SSL library to encrypt connections. MySQL Enterprise uses OpenSSL which is compatible with MongoDB Connector for BI. Use MySQL Enterprise to connect to BI Connector over TLS / SSL.

To connect to a mongosqld instance listening on port 3307, as user grace using authentication mechanism PLAIN, and using specific TLS/SSL CA and x.509 certificates, run the following command:

"C:\Program Files (x86)\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
--enable-cleartext-plugin --protocol tcp --port 3307 ^
--user='grace?mechanism=PLAIN&source=$external' ^
--ssl-ca=X:\path_to_the_CAcert\ca.crt ^
--ssl-key=X:\path_to_my_certificate_key\mysql.key ^
--ssl-cert=X:\path_to_my_client_certificate\mysql.crt ^
-p
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" ^
--enable-cleartext-plugin --protocol tcp --port 3307 ^
--user='grace?mechanism=PLAIN&source=$external' ^
--ssl-ca=X:\path_to_the_CAcert\ca.crt ^
--ssl-key=X:\path_to_my_certificate_key\mysql.key ^
--ssl-cert=X:\path_to_my_client_certificate\mysql.crt ^
-p
mysql --enable-cleartext-plugin --protocol tcp --port 3307 \
--user='grace?mechanism=PLAIN&source=$external' \
--ssl-ca=/path_to_the_CAcert/ca.crt \
--ssl-key=/path_to_my_certificate_key/mysql.key \
--ssl-cert=/path_to_my_client_certificate/mysql.crt \
-p
mysql --enable-cleartext-plugin --protocol tcp --port 3307 \
--user='grace?mechanism=PLAIN&source=$external' \
--ssl-ca=/path_to_the_CAcert/ca.crt \
--ssl-key=/path_to_my_certificate_key/mysql.key \
--ssl-cert=/path_to_my_client_certificate/mysql.crt \
-p

If using the $external authentication source, wrap your username in single quotes or escape the $ character with a backslash to prevent your shell from performing interpolation.

Authentication requires your client to send your password in plain text. To send the password in plain text, either:

  • Use the --enable-cleartext-plugin option shown in the previous example, or

  • Set the environment variable LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN=1.

For additional options, see the MySQL Commands.

See the MySQL documentation for additional details on enabling the MySQL cleartext plugin.

Back

Next