3 Ways to Show the Collation for your Connection in MariaDB

When you run a query against a MariaDB database, MariaDB uses a bunch of system variables to determine which character set and collation to use whenever queries are run. If the client uses a different character set to the server, then MariaDB can translate it into an appropriate character set and collation.

When sending the query results back to the client, MariaDB can translate these results back to a different character set altogether if required. MariaDB uses system variables to determine which character sets and collations to use at each of these steps.

Here are three ways to show the connection collation in MariaDB.

Continue reading

Set the Character Set and Collation of a Database in MariaDB

You can specify the character set and collation at various levels in MariaDB. You can specify them at the connection level, the server level, the database level, the table level, and the column level.

You can also specify a collation in your queries so that it overrides any collation that has been previously specified at the aforementioned levels.

To set the character set and collation at the database level, use the CREATE DATABASE statement or ALTER DATABASE statement (depending on whether you’re creating the database or modifying it).

Continue reading

Set the Character Set and Collation of a Table in MariaDB

You can specify the character set and collation at various levels in MariaDB. You can specify them at the connection level, the server level, the database level, the table level, and even the column level.

You can also specify a collation in your queries so that it overrides any collation that has been previously specified at the aforementioned levels.

To set the character set and collation at the table level, use the CREATE TABLE statement or ALTER TABLE statement (depending on whether you’re creating the table or modifying it).

Continue reading

Show the Collation in MariaDB

In MariaDB, collation can be applied at many levels. Collation can be applied at the server level, the connection level, the database level, the table level, and even at the column level.

It’s also possible to specify a collation at the query level, so that it will override any collation that has been applied at the database, table, or column levels.

MariaDB provides a number of options for returning the collation at the various levels.

Continue reading