60designwebpick mysq GBKl garbled code

WBOY
Release: 2016-07-29 08:35:23
Original
1379 people have browsed it

I now have a sql file, the content of which is gbk. Now my display is full of garbled characters.
It can only be displayed using mysql 4.0.26.
It can’t be displayed even if you use 4.1 or above. The head is big. I hope you all can give me some advice, and I’m very grateful.
I now installed mysql 5.0.22.
I changed the character set in my.ini to gbk, and used the status command to display it, it was all gbk. Then I used the source command to import the sql file, but it still didn't work. Before querying, I used set names gbk, set names utf8, set names latin1. Everything showed garbled characters.
Using mysql -uroot -ppassword databaseThe sql file header is like this.
-- MySQL dump 10.10
--
-- Host: localhost Database: system
---------------------------------- --------------------------
--Server version 5.0.22-community-nt
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT * /;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATI/;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_Z /;
/ *!40103 SET TIME_Z/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECK S=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*
I am speechless. Hope you can give me some advice. Thanks.

Copy the code The code is as follows:


Perfect solution:
1. No matter what method you use, export the SQL text file and make sure that when EDITPLUS opens it, you will see Chinese.
2. Change the statement of the SQL file to 4.1, delete the statement of encoding setting, and then save it.
3. Use the command line to import the 4.1 database. Remember, the encoding of this database must be set to GBK. When creating a table, it will be automatically designated as GBK
Attached command:
mysql -hlocalhost -uroot -p**** database -- default-character-set=gbk < database.sql
When exporting in the future, you must also remember --default-character-set=gbk
When writing a program, you must SET NAMES before mysql query!
The above is my experience accumulated from countless failures and tests over a long period of time.

The above introduces the 60designwebpick mysq GBKl garbled code, including the content of 60designwebpick. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template