Linux下MySQL 3数据库升级到MySQL 4.1乱码问题的完美解决
这两天,研究了一下MySQL升级的乱码问题,终于解决了困扰我很久的问题,这里记录一下,以前相关的文章也已经更新了 以后就可以访问的
这两天,研究了一下MySQL升级的乱码问题,终于解决了困扰我很久的问题,这里记录一下,以前相关的文章也已经更新了
以后就可以访问的更换服务器了
先来看问题描述:
开始的服务器版本: Linux + Apache2.0 + php4.4.0 + mysql3.2.3 无乱码 (SQL导出文件起始地)
开始的本地测试版本: XP + IIS5.1 + php4.4.0 + mysql3.2.3 无乱码
更新的服务器版本: Linux + Apache2.0 + php4.4.0 + mysql4.1 无乱码 (空间提供商上传)
更新的本地测试版本: XP + IIS5.1 + php4.4.0 + mysql4.1 无乱码(不知道为什么,但是后来又乱码了)
最新的本地测试版本: XP + Apache2.0 + php4.4.0 + mysql4.1 乱码....崩溃..3天..未解决..
问题解决:
首先将 sql 文件从服务器上下载下来,或者从什么地方得到这个 sql 执行文件
1. 使用 UltraEdit 打开这个文件,观看文件是否是utf-8格式,下面的状态栏有提示,如果不是文件另存为UTF-8(无BOM)格式,观看文件的中文字符,是否显示正常,显示正常OK,继续
说明: 记着是 UltraEdit ,因为这个软件支持UTF-8编码文件(其他的也可以),windows自带的记事本可能出现匪夷所思的事情,无(BOM)格式也很重要,PHP不支持BOM头... 如果这里无法显示正常的话,不可能往下进行了...我试过,所以说多用不同形式导出几次,使得原始数据正常
2. 如果sql文件出现,新建表指令,注意中间的
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=101 ;
修改为: ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=101 ;
说明: 本操作就是告诉mysql表使用什么字符集
3. 新建数据库,使用 utf8_general_ci
4. 使用 phpMyAdmin 导入该文件到 mysql4, 导入的文件编码选择 UTF-8
说明: 如果导入错误,看看是否出现语法错误,修改,继续导入
5. 使用 phpMyAdmin 浏览相关记录,观看中文记录是否显示正常,正常继续
6. 浏览你的php程序,观看,读取数据库内容,仍然乱码,在打开数据库 @mysql_connect( $host, $user, $pass ) 类似语句之后添加 @mysql_query("SET NAMES 'utf8'");
7. 刷新网页,OK,成功
说明:
中间任何的过程出现错误,将导致转换失败
这里还有一个问题,就是现在所有的数据,前台数据,数据库数据,和传输过程的数据都用utf-8格式,所以相关的数据量必然会增大,如果网页特别巨大,而且考虑到页面加载问题,可能会出现一点问题
恩,相关的知识就不在这里细说了,我已经写在了这个博客中的"网站开发"类别中,想了解的,可以去看看
个人感觉.很复杂.mysql,phpmyadmin,php,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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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











Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

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.

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.
