MariaDB
MariaDB Start Guide
Remember: We use the same driver extension to connect for both MariaDB and MySQL, so some of the settings and documentation refer to
mysqlorMySQL.
1. Connections
Connection example:
{
"name": "MariaDB",
"server": "localhost",
"driver": "MariaDB",
"port": 3306,
"database": "test_db",
"username": "root",
"askForPassword": false,
"password": "root",
"connectionTimeout": 15
}
Using a socket file example:
{
"name": "MariaDB",
"driver": "MariaDB",
"database": "test_db",
"username": "root",
"askForPassword": false,
"password": "root",
"connectionTimeout": 15,
"socketPath": "/path/to/mysqld.sock"
}
1.1 Specific Options
MariaDB driver specific options can be passed using mysqlOptions settings.
{
"name": "MariaDB",
"server": "localhost",
"driver": "MariaDB",
"port": 5433,
"database": "test_db",
"username": "root",
"askForPassword": false,
"password": "root",
"connectionTimeout": 15,
"mysqlOptions": {
... // options See section 2. mysqlOptions
}
}
2. mysqlOptions
We have two options of connectors for MariaDB. You can choose which one to use by change the setting mysqlOptions.authProtocol. The allowed values are default and xprotocol, we use default by default since is the most often used.
Extra options can be used as defined in the connectors documentation.
- For default protocol
- For xprotocol
They will be passed to the pool constructor directly. See https://github.com/mtxr/vscode-sqltools/blob/master/packages/core/driver/mysql/index.ts .
Know Errors and How to Fix
MariaDB 8 and ER_NOT_SUPPORTED_AUTH_MODE
Potential solutions:
- Ensure you’ve set
authProtocoltoxprotocol - Use the correct port. Typically, add a trailing
0to theportused by thedefaultprotocol.
Example configuration:
{
"sqltools.connections": [
{
"askForPassword": true,
"connectionTimeout": 30,
"driver": "MariaDB",
"name": "LocalHost",
"port": 33060,
"server": "127.0.0.1",
"username": "root",
"mysqlOptions": {
"authProtocol": "xprotocol"
}
}
]
}
Connection Options
askForPasswordbooleanAsk for password at connection time instead of storing it as plaintext in your settings.
Ask for password at connection time instead of storing it as plaintext in your settings.
| Type | boolean |
| Default Value | false |
connectionTimeoutnumberConnection timeout in seconds.
Connection timeout in seconds.
| Type | number |
| Default Value | 15 |
connectStringstring | nullConnect string. Support for Oracle, PostgreSQL and AWS Redshift.
Connect string. Support for Oracle, PostgreSQL and AWS Redshift.
| Type | string or null |
cqlOptionsobject | nullSee https://docs.datastax.com/en/developer/nodejs-driver/4.1/api/type.ClientOptions/ for more details.
See https://docs.datastax.com/en/developer/nodejs-driver/4.1/api/type.ClientOptions/ for more details.
| Type | object or null |
| Default Value | {} |
databasestringDatabase name.
Database name.
| Type | string |
dialectstringConnection Driver
Connection Driver
| Type | string |
driverstringConnection driver used for this connection.
Connection driver used for this connection.
| Type | string |
groupstringConnection group name.
Connection group name.
| Type | string |
mysqlOptionsobject | nullSee https://vscode-sqltools.mteixeira.dev/en/drivers/my-sql#2-mysqloptions for more details.
See https://vscode-sqltools.mteixeira.dev/en/drivers/my-sql#2-mysqloptions for more details.
| Type | object or null |
| Default Value | {} |
| Property | Description | Type |
|---|---|---|
| authProtocol | string
| |
| ssl | boolean, object, string or null |
namestringConnection name.
Connection name.
| Type | string |
passwordstring | nullConnection password
Connection password
| Type | string or null |
portnumberPort for connection.
Port for connection.
| Type | number |
previewLimitnumberMaximum number of records to return in table previews.
Maximum number of records to return in table previews.
| Type | number |
| Default Value | 50 |
serverstringServer address.
Server address.
| Type | string |
| Default Value | 127.0.0.1 |
socketPathstringPath of socket file to connect using UNIX sockets. MySQL only for now.
Path of socket file to connect using UNIX sockets. MySQL only for now.
| Type | string |
usernamestringConnection username.
Connection username.
| Type | string |
variablesobject | nullConnection variables in a key/value pair format. Use this property with sqltools.queryParams.enableReplace to replace the variables without prompting.
Connection variables in a key/value pair format. Use this property with sqltools.queryParams.enableReplace to replace the variables without prompting.
| Type | object or null |
| Default Value | null |
| Property | Description | Type |
|---|