mysql命令提示行连接乱码的解决
今天在dos下连接mysql数据库的时候,出现了乱码,需要的朋友可以参考下。
WINDOWS1、MySQL是有一些环境变量可以设置,
可输入:show variables;可查看当前的环境变量设置;
2、这些变量当中有一部分与字符相关的设置,
可输入:show variables like ´character%´;查看;
3、其中character_set_results决定返回结果的编码,
windows下设为gb2312即可正常显示中文;
设置方法:set character_set_results=gb2312;,然后回车即可;
4、当然,如果想通过命令提示行窗口来输入中文修改数据库内容,
则可以试试设置set character_set_connection=gb2312;
以及set character_set_client=gb2312;
说明:
以上在命令提示行窗口中设置的值,
其有效期仅仅为本次连接有效,
即断开本次连接之后,
重新连接进来,
所有所设置的变量又恢复到默认的值了。
ubuntu9.0.4 mysql乱码解决办法
操作系统环境:
ubuntu9.0.4、MySql5.1(通过sudo apt-get install mysql5.1安装)
现象:
在终端
1.mysql -uroot -proot 进入mysql客户端
2.use parking 选中一个数据库
3.select *from users 选择一个用户表
里面中文字段显示为???
4.使用语句show variables like 'character%'
则会显示有几个选项为latin的,并不是utf8
解决步骤:
1. 找到mysql的配置文件
mysql的配置文件就是/etc/init.d/mysql/my.cnf。(如果不是ubuntu9.0.4,这个文件并不一定存在,由于你可能采取的MySQL安装方式跟网上所说的不一样,就不一定能够找得到/etc/init.d/mysql/my.cnf。因此,你需要使用find命令查找cnf文件。记得不要去找my.cnf因为它不一定存在,而应该找*.cnf。
2.修改前应该备份一下cp /etc/init.d/mysql/my.cnf /etc/my.cnf.bak
打开my.cnf修改编码
# sudo vi /etc/init.d/mysql/my.cnf
在[mysqld]下添加
default-character-set=utf8
在[client]下添加
default-character-set=utf8
3. 重启mysql
根据你安装mysql的方式的不同,采用不用的命令来重启你的mysql。如果你配置过使用mysqld自启动方式,可以执行
cd /usr/bin/
mysqladmin -uroot -proot shutdownmysqld_safe & (如果权限不够的话就执行 sudo mysql_safe &)
4.使用语句show variables like 'character%'
则会只有一个是latin,其余的是utf8
更改 windows 下 cmd(dos) 编码方式 将其改为UTF-8
chcp 命令,
chcp 65001 就是换成UTF-8代码页
chcp 936 可以换回默认的GBK
chcp 437 是美国英语备注:个人测试CMD下修改编码不能解决MYSQL乱码

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Solution to garbled word page numbers: 1. Open the word document and click the "File" option in the upper left corner; 2. Select the "More" option, and then click the "Options" button; 3. Select "Advanced" in the word options; 4. . Find "Show field codes instead of field values" in "Show document content", remove the check in front, and click OK to return to the home page.

The Linux Chinese garbled problem is a common problem when using Chinese character sets and encodings. Garbled characters may be caused by incorrect file encoding settings, system locale not being installed or set, and terminal display configuration errors, etc. This article will introduce several common workarounds and provide specific code examples. 1. Check the file encoding setting. Use the file command to view the file encoding. Use the file command in the terminal to view the encoding of the file: file-ifilename. If there is "charset" in the output

Solutions to garbled tomcat startup: 1. Modify Tomcat's conf configuration file; 2. Modify the system language; 3. Modify the command line window encoding; 4. Check the Tomcat server configuration; 5. Check the project encoding; 6. Check the log file; 7 , try other solutions. Detailed introduction: 1. Modify Tomcat's conf configuration file, open Tomcat's conf directory, find the "logging.properties" file, etc.

Solution to Chinese garbled characters in Linux tty: 1. Download the font fbterm through the "sudo apt-get install fbterm" command; 2. Execute the "sudo fbterm" command; 3. Change the font and font size to "font-names=Ubuntu Mono font- size=14” is enough.

In the Windows 10 system, garbled characters are common. The reason behind this is often that the operating system does not provide default support for some character sets, or there is an error in the set character set options. In order to prescribe the right medicine, we will analyze the actual operating procedures in detail below. How to solve Windows 10 garbled code 1. Open settings and find "Time and Language" 2. Then find "Language" 3. Find "Manage Language Settings" 4. Click "Change System Regional Settings" here 5. Check the box as shown and click Just make sure.

How to solve the problem of garbled text documents in win11? When many users use the win11 system, text documents are garbled and cannot be read normally. Many friends do not know how to solve this problem. In fact, this method is not difficult. Below, the editor has compiled the steps to solve the problem of garbled Windows 11 system documents. I hope it can bring you some inspiration! Steps to solve garbled Windows 11 system documents: 1. First, open the control panel of win11, enter control panel in the search box below, and click Search to enter the control panel. 2. After entering the panel, find the clock and area and click to enter, then click on the area option. 3. After entering, click on the management panel, and then click on Change system regional settings.

When many users use computers, they will find that there are many files with the suffix dll, but many users do not know how to open such files. For those who want to know, please take a look at the following details. Tutorial~How to open and edit dll files: 1. Download a software called "exescope" and download and install it. 2. Then right-click the dll file and select "Edit resources with exescope". 3. Then click "OK" in the pop-up error prompt box. 4. Then on the right panel, click the "+" sign in front of each group to view the content it contains. 5. Click on the dll file you want to view, then click "File" and select "Export". 6. Then you can

Some friends want to open a notepad and find that their win11 notepad is garbled and don't know what to do. In fact, we generally only need to modify the region and language. Win11 Notepad is garbled: First step, use the search function, search and open "Control Panel" Second step, click "Change date, time or number format" under Clock and Region Third step, click the "Manage" option above Card. The fourth step is to click "Change System Regional Settings" below. The fifth step is to change the current system regional settings to "Chinese (Simplified, China)" and click "OK" to save.
