Home Database Mysql Tutorial MySQL控制台更新数据乱码解决_MySQL

MySQL控制台更新数据乱码解决_MySQL

Jun 01, 2016 pm 01:32 PM
console

bitsCN.com

MySQL控制台更新数据乱码解决

 

问题:

在MySQL控制台中输入如下语句:

 

INSERT INTO table_name VALUES ('中文');
Copy after login

最终在数据库存放的数据为乱码。

解决:

添加mysql客户端连接的字符集参数。(下面我们假设数据库的编码为utf-8)

1. 在控制台启动命令之后添加字符集参数

1$ mysql --default-character-set=utf8
Copy after login

注意,这边的的字符集是utf8而不是utf-8。

2. 在mysql的配置文件my.cnf中添加字符集参数

在/etc/my.cnf文件中添加如下配置

1[mysql]2default-character-set=utf8
Copy after login

 

 

bitsCN.com
Statement of this Website
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

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 ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to install the Group Policy Management Console on Windows 11 How to install the Group Policy Management Console on Windows 11 May 17, 2023 am 09:59 AM

Installing the Group Policy Management Console (also known as GPMC) on Windows 11 will be the topic of today’s post. In Windows systems, the tools we are discussing improve the management of Group Policy by making it easier for IT and system administrators to understand. Be careful not to confuse the Local Group Policy Editor (gpedit.msc) with the Group Policy Management Console (GPMC). In terms of local system settings, Gpedit works with the registry, but GPMC works with server management settings for domain-based networks. You need to download and install the Windows Remote Server Administration Tools, sometimes called RSAT, to accomplish this. Use remote server management

7 Ways to Fix Won't Calibrate Windows 11 Touch Screen 7 Ways to Fix Won't Calibrate Windows 11 Touch Screen Apr 23, 2023 pm 10:49 PM

Have a Windows 11 touchscreen laptop that won't calibrate or doesn't work? This can be frustrating, especially if the only access option is through a device with a touch screen. While Windows touch screen devices are known for their smooth functionality, especially for graphically demanding applications, things can sometimes go wrong. You may encounter issues such as the touch screen not working properly or sometimes the Windows 11 touch screen won't calibrate at all. While we have already covered how to calibrate your touch screen on Windows 10, here we will discuss some solutions that may help you when your Windows 11 touch screen won’t calibrate. Does the touch screen work with Wind?

Xbox System Error E200 [Fixed] Xbox System Error E200 [Fixed] Feb 19, 2024 pm 02:39 PM

This article will explain how to resolve system error E200 on your Xbox console. Typically, this error occurs when your Xbox console gets interrupted while trying to install the latest console operating system update. This error may also occur if the system update is interrupted due to a power outage or network problem. Fix Xbox System Error E200 Use the following fix to fix System Error E200 on your Xbox console: Turn your Xbox console off and on again Perform a system update factory reset your console Let’s get started. 1] Turning your Xbox console off and on again Resetting the power cycle of your Xbox console can effectively eliminate potential temporary glitches and resolve some issues. Follow these steps to turn off and reopen Xbox Control

How to reset your Xbox Series S or X controller How to reset your Xbox Series S or X controller Jun 03, 2023 pm 08:19 PM

The Xbox gaming console is a favorite among gamers. With the new SeriesX and SeriesS, gaming is almost a lifelike experience. The Xbox controller is your primary tool for experiencing gaming effects. Sometimes the controller connection gets cut off or some errors are encountered while trying to connect the controller to the main console. This may be due to various issues related to pairing. This can be overcome with a few simple steps. Reset your Xbox Series S or Xbox Series X controller Step 1: Press and hold the Xbox button on your controller for a few seconds to turn off the controller. Step 2: On the screen, go to Turn off controller and press button A to select that option. NOTE: If you keep pressing X

Best way to reinstall or repair Microsoft Store Best way to reinstall or repair Microsoft Store Apr 14, 2023 pm 03:43 PM

Microsoft Store is one of the most important applications installed for Windows 11 users. Here you can purchase apps, games, and other content for your computer. With the launch of Windows 11, these programs also come with updated UI to match the operating system design, and Microsoft Store is not far behind. Its main purpose is to provide a unified experience for finding and downloading software and applications. You can browse categories like games, music, movies, TV shows, and more. The newly revamped store offers more services than the Windows 10 version. One of the most notable differences between the two stores is their design. Secondly, there are more applications and games, not only

Windows 11 Computer Management: How to turn it on in 8 steps Windows 11 Computer Management: How to turn it on in 8 steps Apr 29, 2023 pm 03:28 PM

There are many features and services running on Windows PC, allowing users to take full advantage of it. They are distributed throughout the system and often not accessible in one location. Therefore, the need for Windows 11 computer management is crucial as it allows you to access a range of Windows management tools to manage your computer. What is Computer Management Console? Computer Management is a set of management tools on Windows PCs that Microsoft provides for managing local and remote computers. It allows users to access many management tools such as Task Scheduler, Event Viewer, Device Manager, Disk Management, Service Manager, etc. Additionally, every management tool in console management is encapsulated and organized into a single console

How to clear console in C language? How to clear console in C language? Sep 23, 2023 pm 09:57 PM

There are several ways to clear the console or output screen, one of which is the clrscr() function. It clears the screen when the function is called. It is declared in the "conio.h" header file. There are some other methods such as system("cls") and system("clear"), which are declared in the "stdlib.h" header file. The following is the syntax for clearing the console in C language: clrscr();ORsystem("cls");ORsystem("clear");The following is a use

How to use the print() function to output content to the console in Python 3.x How to use the print() function to output content to the console in Python 3.x Jul 29, 2023 pm 01:07 PM

How to use the print() function in Python3.x to output content to the console. In Python, the print() function is a very commonly used function, which can output specified content to the console. This article will introduce in detail how to use the print() function to achieve this function, and attach the corresponding code examples. First, let us understand the basic usage of the print() function. The print() function can accept one or more parameters as input and put them in comma-separated form

See all articles