search
HomeOperation and MaintenanceCentOSChinese garbled characters appear in mysql under centos system

Chinese garbled characters appear in mysql under centos system

Mar 20, 2020 pm 02:29 PM
centosmysqlGarbled characters

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:

Chinese garbled characters appear in mysql under centos system

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to easily configure Redis clusters in CentOSHow to easily configure Redis clusters in CentOSApr 14, 2025 pm 04:06 PM

Configuring 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 settingsHow to do CentOS Stream 8 security settingsApr 14, 2025 pm 04:03 PM

CentOSStream8 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 CentOSHow to set Zookeeper's environment variables on CentOSApr 14, 2025 pm 04:00 PM

Configuring 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 CentOSHow to manage user permissions of Zookeeper on CentOSApr 14, 2025 pm 03:57 PM

Managing 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 CentOSHow to monitor PyTorch running status on CentOSApr 14, 2025 pm 03:54 PM

To 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 TutorialCentOS Stream 8 Firewall Setting TutorialApr 14, 2025 pm 03:51 PM

CentOSStream8 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 recoverycentos zookeeper data backup and recoveryApr 14, 2025 pm 03:48 PM

Guide 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 storageHow to manage CentOS HDFS storageApr 14, 2025 pm 03:45 PM

Managing 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,

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

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

WebStorm Mac version

Useful JavaScript development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

mPDF

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

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool