5.中文问题(自身,操作系统级别,应用软件的本身),mysql数据
第一层因素: mysql的自身的设置 mysql有六处使用了字符集,分别为:client 、connection、database、results、server 、system。 mysqlshow variables like character%; +--------------------------+----------------------------+ | Variable_name | Value
第一层因素:mysql的自身的设置
mysql有六处使用了字符集,分别为:client 、connection、database、results、server 、system。
mysql>show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
mysql -uroot -p--default_character_set=gbk; (影响数据的输入和输出)
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
insertinto worker(id,name,sex,birthday,salary,entry_date,resume) values(3,'赵六',0,'1985-09-21',7000,'2012-08-24','一个小小牛');
====>错误现象
mysql>insert into worker(id,name,sex,birthday,salary,entry_date,resume) values(3,'赵六',0,'1985-09-21',7000,'2012-08-24','一个小小牛');
ERROR 1366 (HY000): Incorrect string value:'\x80\xE4\xB8\xAA\xE5\xB0...' for column 'resume' at row 1
mysql>
====结论: 让你的客户端 服务器 连接 ,都必须设置成一样 utf8gbk
第二层因素
操作系统语言环境的设置
a)操作系统的总体的语言环境
[mysql01@localhost~]$ cat /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
[mysql01@localhost~]$
b)当前用户的语言环境 linux的操作系统是基于多用户的操作系统
[mysql01@localhost~]$ env | grep LANG*
LANG=zh_CN.UTF-8
[mysql01@localhost~]$
=====>当前用户的LANG设置能屏蔽操作系统语言环境设置
实现:修改当前用户的语言环境
[mysql01@localhost~]$ env | grep LANG
LANG=C
[mysql01@localhost~]$
insertinto worker(id,name,sex,birthday,salary,entry_date,resume) values(3,'赵六六',0,'1985-09-21',7000,'2012-08-24','一个小牛');
第三层因素
你的应用软件的本身 文件的 存储问题....
文件存储
最常用有2种方式:utf8 code936
==== gbk转宽字节的函数....widewinskd函数 gbk转成宽字节(Unicode2)
备份mysql数据库
$ mysqldump -uroot -p mydb2 > 2.sql
//恢复msql数据库
$ mysqldump -uroot -p mydb2

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



In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

To fill in the MySQL username and password: 1. Determine the username and password; 2. Connect to the database; 3. Use the username and password to execute queries and commands.

1. Use the correct index to speed up data retrieval by reducing the amount of data scanned select*frommployeeswherelast_name='smith'; if you look up a column of a table multiple times, create an index for that column. If you or your app needs data from multiple columns according to the criteria, create a composite index 2. Avoid select * only those required columns, if you select all unwanted columns, this will only consume more server memory and cause the server to slow down at high load or frequency times For example, your table contains columns such as created_at and updated_at and timestamps, and then avoid selecting * because they do not require inefficient query se

View the MySQL database with the following command: Connect to the server: mysql -u Username -p Password Run SHOW DATABASES; Command to get all existing databases Select database: USE database name; View table: SHOW TABLES; View table structure: DESCRIBE table name; View data: SELECT * FROM table name;

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

Navicat itself does not store the database password, and can only retrieve the encrypted password. Solution: 1. Check the password manager; 2. Check Navicat's "Remember Password" function; 3. Reset the database password; 4. Contact the database administrator.

Create a database using Navicat Premium: Connect to the database server and enter the connection parameters. Right-click on the server and select Create Database. Enter the name of the new database and the specified character set and collation. Connect to the new database and create the table in the Object Browser. Right-click on the table and select Insert Data to insert the data.

Copy and paste in MySQL includes the following steps: select the data, copy with Ctrl C (Windows) or Cmd C (Mac); right-click at the target location, select Paste or use Ctrl V (Windows) or Cmd V (Mac); the copied data is inserted into the target location, or replace existing data (depending on whether the data already exists at the target location).
