Chinese garbled characters appear in mysql under centos system

1. Log in to MySQL to view the character set using SHOW VARIABLES LIKE 'character%';, the display is as follows:

character_set_database and The default character set of character_set_server is still latin1.
(Recommended tutorial: centos usage tutorial)
Solution:
Just modify the character set key value in the my.cnf file of mysql .
1. Add default-character-set=utf8 in the [client] field, as follows:
[client] default-character-set=utf8
2. Add character-set-server= in the [mysqld] field utf8, as follows:
[mysqld] port = 3306 socket = /var/lib/mysql/mysql.sock character-set-server=utf8
3. Add default-character-set=utf8 in the [mysql] field, as follows:
[mysql] no-auto-rehash default-character-set=utf8
After the modification is completed, execute the command service mysql restart Just restart the mysql service.
Note: There is a difference between the [mysqld] field and the [mysql] field.
Recommended related video tutorials: linux video tutorial
The above is the detailed content of Chinese garbled characters appear in mysql under centos system. For more information, please follow other related articles on the PHP Chinese website!
How to easily configure Redis clusters in CentOSApr 14, 2025 pm 04:06 PMConfiguring a Redis cluster on CentOS can be achieved through the following steps. Here is a basic guide, assuming you have CentOS7 or higher installed and Redis is already installed. Prerequisites Install Redis: sudoyumininstalllepel-releasesudoyumininstallredis Start Redis service: sudosystemctlstartredissudosystemctle
How to do CentOS Stream 8 security settingsApr 14, 2025 pm 04:03 PMCentOSStream8 Security Reinforcement Guide: Key Steps to Improve System Security This article outlines the key steps to enhance the security of CentOSStream8 system, aiming to build a safer operating environment. These security measures cover account management, system services, network security, and system maintenance. Account security and permission control Disable redundant superuser accounts: Identify accounts with root permissions: Use cat/etc/passwd|awk-F':''{print$1,$3}'|grep'0$' command. Backup and lock/unlock the account: Backup /etc/passwd file (cp-p
How to set Zookeeper's environment variables on CentOSApr 14, 2025 pm 04:00 PMConfiguring ZooKeeper environment variables in CentOS system, you can implement them in two ways: Method 1: Global configuration (affecting all users). This method modifies the /etc/profile file so that all users can access ZooKeeper environment variables. Open the terminal and use root permissions to edit the configuration file: sudovi/etc/profile add the following at the end of the file, replace /opt/zookeeper-3.7.0 with your actual installation path of ZooKeeper: exportZOOKEEPER_HOME=/opt/zookeeper-3.7.0exportPATH
How to manage user permissions of Zookeeper on CentOSApr 14, 2025 pm 03:57 PMManaging Zookeeper's user rights on CentOS usually involves the following aspects: 1. Configure Zookeeper's ACL (AccessControlLists) Zookeeper supports ACL-based permission management, which can be set through configuration files or command lines. Edit the zoo.cfg file through the configuration file settings ACL, add or modify the following content: authProvider.1=org.apache.zookeeper.server.auth.S
How to monitor PyTorch running status on CentOSApr 14, 2025 pm 03:54 PMTo efficiently monitor PyTorch running status on CentOS system, you can adopt the following strategies to choose the appropriate solution for different needs: GPU monitoring (nvidia-smi): If you use NVIDIAGPU and have CUDA and cuDNN installed, the nvidia-smi command is an ideal tool for monitoring GPU resource utilization, memory footprint and temperature. Real-time monitoring can be used with the watch command: watch-n1nvidia-smi This will update the GPU status display once a second. System-level process monitoring (htop): htop is an interactive process viewer that can intuitively display the resource consumption of all processes, including you
CentOS Stream 8 Firewall Setting TutorialApr 14, 2025 pm 03:51 PMCentOSStream8 Firewall Management Guide: Use firewalld to finely control network access CentOSStream8 system uses firewalld as a dynamic firewall management tool, which defines the security level of different network traffic using the concept of "zones". This guide will gradually explain the basic configuration and management methods of firewalld. 1. Install firewalld If firewalld is not installed, please execute the following command: sudodnfinstallfirewalld 2. Start and status check Start the firewalld service: sudosystemctlstartfi
centos zookeeper data backup and recoveryApr 14, 2025 pm 03:48 PMGuide to Backup and Recovery of ZooKeeper Data in CentOS System This article explains how to safely and reliably backup and restore ZooKeeper data in CentOS system, mainly relying on ZooKeeper's own data backup mechanism and tools. ZooKeeper data backup mechanism ZooKeeper uses the following mechanism to ensure data security: Snapshot: ZooKeeper regularly copies the data state in memory to the snapshot file on disk. This is a full backup of the data. TransactionLog: Records all transaction operations for data recovery and state reconstruction. Backup tool commonly used backup tool kit
How to manage CentOS HDFS storageApr 14, 2025 pm 03:45 PMManaging HDFS (HadoopDistributedFileSystem) storage on CentOS involves many aspects, including installation, configuration, monitoring, permission management, etc. Here are some key steps and strategies: Install Hadoop with HDFS Installation and Configuration: First, you need to install Hadoop on CentOS. You can refer to official documents or third-party tutorials to download and install the appropriate version. Configure Hadoop environment variables: edit /etc/profile file, add Hadoop-related environment variables,


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

WebStorm Mac version
Useful JavaScript development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool






