Leave a comment at the end of this page or email contact@krishagni.com
MySQL prerequisites
1. Before You Begin
Important: Perform these steps before creating the database.
Note: Restart MySQL after making any changes to
my.cnf.
2. Locate and Edit my.cnf
The
my.cnffile is usually found in your MySQL directory.
3. Configuration Settings
A. Settings to Add Above [mysqld] Section
These settings apply to the MySQL client:
[client]
default-character-set=utf8mb4B. Settings to Add Under [mysqld] Section
These settings configure the MySQL server:
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
init_connect='SET collation_connection = utf8mb4_unicode_ci'
lower_case_table_names=1
innodb_buffer_pool_size=2048M
log_bin_trust_function_creators=1
optimizer_search_depth=0
skip-character-set-client-handshakeNote:
The value of innodb_buffer_pool_size can be set to 50% of available RAM if the database server is dedicated (no other apps running).
Remove skip-character-set-client-handshake for MySQL 8 to avoid collation errors in mysqldump.
4. Restart MySQL Service
Ubuntu
service mysql restartRedHat / CentOS
systemctl restart mysqld5. Verify Configuration
Connect to MySQL
Run:
show variables like '%char%';Confirm that all variables are set to the correct values.
Repeat for all variables as needed.
Additional Notes
Character Encoding:
Settingutf8mb4ensures support for a wide range of characters.Case Sensitivity:
lower_case_table_names=1makes table/database names case-insensitive (recommended for Linux).Collation:
utf8mb4_unicode_cisupports most Western languages.