Warning
Error Code: 3719

MySQL Error 3719: Deprecated UTF8 Alias Usage

📦 MySQL
📋

Description

This error is a warning indicating that you are using the 'utf8' character set alias, which currently maps to UTF8MB3. MySQL is notifying you that in a future release, this alias will change its meaning to UTF8MB4. This prompts users to explicitly use UTF8MB4 to avoid future ambiguity and potential compatibility issues.
💬

Error Message

'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
🔍

Known Causes

3 known causes
⚠️
Implicit UTF8 Character Set
Creating databases, tables, or columns using `CHARACTER SET utf8` without explicitly specifying `UTF8MB3` or `UTF8MB4`.
⚠️
Legacy Application Schemas
Using schema definitions from older applications or systems that relied on the `utf8` alias implicitly mapping to `UTF8MB3`.
⚠️
Database Migration
Migrating a database from an older MySQL version where the `utf8` alias behavior was different or less ambiguously interpreted.
🛠️

Solutions

3 solutions available

1. Update Character Set Declarations to UTF8MB4 medium

Directly specify UTF8MB4 in your MySQL configuration and table/column definitions.

1
Modify your MySQL server configuration file (e.g., `my.cnf` or `my.ini`) to explicitly set `character-set-server` and `collation-server` to UTF8MB4.
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
2
Restart the MySQL server to apply the configuration changes.
sudo systemctl restart mysql  # Or appropriate command for your OS
3
For existing databases and tables, alter them to use UTF8MB4. This can be done for the entire database or individual tables and columns.
ALTER DATABASE your_database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
ALTER TABLE your_table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
4
When creating new tables, explicitly define the character set and collation.
CREATE TABLE new_table (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

2. Use `ALTER USER` for Default Character Set easy

Change the default character set for specific users to UTF8MB4.

1
Connect to your MySQL server as a user with sufficient privileges (e.g., root).
mysql -u root -p
2
Execute the `ALTER USER` statement to set the default character set for the user.
ALTER USER 'your_user'@'localhost' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
3
Repeat for all relevant users.
ALTER USER 'another_user'@'%' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. Update Application Connection Strings easy

Modify your application's database connection strings to specify UTF8MB4.

1
Locate the database connection configuration in your application's code or configuration files.
Example (Python with SQLAlchemy):
engine = create_engine('mysql+mysqlconnector://user:password@host/database?charset=utf8mb4')
2
Add or update the `charset` parameter in the connection string to `utf8mb4`.
Example (Java JDBC):
jdbc:mysql://localhost:3306/mydatabase?characterEncoding=utf8mb4
3
Recompile and redeploy your application if necessary.
N/A
🔗

Related Errors

5 related errors