谁做过这个....

luozhi9 2008-09-05 04:01:44
mysql..把5.0的数据库...导入到..4.0版本中...

有什么好办法..解决字符问题....
...全文
83 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
iihero_ 2008-09-10
  • 打赏
  • 举报
回复
你是用mysqldump从5.0中导出的吧,对它加上参数--default-character-set=gbk试试,
导入4.0之前,将4.0的mysqld的字符集也改为gbk
luozhi9 2008-09-10
  • 打赏
  • 举报
回复
[Quote=引用 17 楼 WWWWA 的回复:]
册多了 ENGINE=InnoDB DEFAULT CHARSET=latin1;?
[/Quote]

这个都不用要...反正就是按照4.0哪种格式就OK...

呵呵..
WWWWA 2008-09-10
  • 打赏
  • 举报
回复
呵呵,解决就好
WWWWA 2008-09-09
  • 打赏
  • 举报
回复
册多了 ENGINE=InnoDB DEFAULT CHARSET=latin1;?
luozhi9 2008-09-09
  • 打赏
  • 举报
回复
以下是5.0导出的数所内容..

-- MySQL dump 10.11
--
-- Host: localhost Database: HKDB
-- ------------------------------------------------------
-- Server version 5.0.67-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `hk_user`
--

DROP TABLE IF EXISTS `hk_user`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `hk_user` (
`userid` bigint(20) unsigned NOT NULL,
`passwd` bigint(20) unsigned NOT NULL,
`username` char(20) NOT NULL,
`count` mediumint(8) unsigned NOT NULL default '0',
`flags` tinyint(3) unsigned NOT NULL default '0',
`alias` varchar(255) default NULL,
PRIMARY KEY (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;

--
-- Dumping data for table `hk_user`



以下是4.0导出的内容..经过对比.发现不同的地方.都改成与..4.0一样的..5.0的数据就可以放到4.0中去了..
不过这个方法.对于大量的数来说.不是很方便了.

这样什么都不用管噢..也不用管字符集之类的问题..


-- MySQL dump 9.11
--
-- Host: localhost Database: hkdb
-- ------------------------------------------------------
-- Server version 4.0.20-standard

--
-- Table structure for table `hk_admin`
--

CREATE TABLE `hk_admin` (
`userid` bigint(20) unsigned NOT NULL,
`passwd` bigint(20) unsigned NOT NULL,
`username` char(20) NOT NULL,
`count` mediumint(8) unsigned NOT NULL default '0',
`flags` tinyint(3) unsigned NOT NULL default '0',
`alias` varchar(255) default NULL,
`type` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`userid`)
);

--
-- Dumping data for table `hk_admin`
wwwwb 2008-09-08
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 luozhi9 的回复:]
呵呵..

才用最笨的办法..解决了...
[/Quote]
共享一下怎么解决的,谢谢
懒得去死 2008-09-06
  • 打赏
  • 举报
回复
参考
http://blog.chinaunix.net/u/29134/showart_1120575.html
luozhi9 2008-09-05
  • 打赏
  • 举报
回复
呵呵..

才用最笨的办法..解决了...
luozhi9 2008-09-05
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 WWWWA 的回复:]
MYSQL字符集设置比较麻烦,最好开始就设置为UTF8,用高版本的MYSQL,以免麻烦
[/Quote]

没办法..现在我们用别人的一台服务器测试一点东西..不好改别人的.
WWWWA 2008-09-05
  • 打赏
  • 举报
回复
MYSQL字符集设置比较麻烦,最好开始就设置为UTF8,用高版本的MYSQL,以免麻烦
luozhi9 2008-09-05
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 WWWWA 的回复:]
先要在MYSQL5中修改成相应的字符集(GBK、latin1等等),数据库、表、字段的字符集设置,看看有无问题
[/Quote]

我在5.0中导出..库的时候才用的是GBK导出来的...

我现在准备..在4.0版本中也导出一个库..对比一下.看有什么不同...呵呵

最笨方法...
WWWWA 2008-09-05
  • 打赏
  • 举报
回复
先要在MYSQL5中修改成相应的字符集(GBK、latin1等等),数据库、表、字段的字符集设置,看看有无问题
luozhi9 2008-09-05
  • 打赏
  • 举报
回复
哪我是不是要.把.
SET character_set_client = utf8;

改成下面这样了..
SET character_set_client = latin1;
WWWWA 2008-09-05
  • 打赏
  • 举报
回复
yes
mysql 4.0及之前的版本,都是只支持一种字符集latin1,从mysql 4.1起,支持众多的字符集,比如gbk,utf8(非utf-8)等。
gbk,utf8等多字节字符集的存储也发生了变化,比如latin1下,汉字字长是2,在gbk或utf8下,汉字字长就是1。也就是说原来varchar(32)只能存16个汉字,现在能保存32个了。
luozhi9 2008-09-05
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 WWWWA 的回复:]
导出没有问题,导出时设置为UTF8,MYSQL4是怎么设置 的?
[/Quote]

对了mysql 4.0好像不支持UTF8吧..
是不是要改成别的了比如...gb2312....
WWWWA 2008-09-05
  • 打赏
  • 举报
回复
导出没有问题,导出时设置为UTF8,MYSQL4是怎么设置 的?
luozhi9 2008-09-05
  • 打赏
  • 举报
回复

-- MySQL dump 10.11
--
-- Host: localhost Database: hkdb
-- ------------------------------------------------------
-- Server version 5.0.51b-community
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `hk_admin`
--

SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `hk_admin` (
`userid` bigint(20) unsigned NOT NULL,
`passwd` bigint(20) unsigned NOT NULL,
`username` char(20) NOT NULL,
`count` mediumint(8) unsigned NOT NULL default '0',
`flags` tinyint(3) unsigned NOT NULL default '0',
`alias` varchar(255) default NULL,
`type` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`userid`)
);
SET character_set_client = @saved_cs_client;

--
-- Dumping data for table `hk_admin`
--


--
-- Table structure for table `hk_admin_info`
--

SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `hk_admin_info` (
`userid` bigint(20) unsigned NOT NULL,
`sex` tinyint(1) default NULL,
`birthday` varchar(30) default NULL,
`mail` varchar(30) default NULL,
`phone` varchar(30) default NULL,
`agentid` bigint(20) default NULL,
`spacesize` int(11) unsigned NOT NULL default '0',
`status` tinyint(1) NOT NULL default '0',
`authpwd` varchar(30) default NULL,
`remark` varchar(255) default NULL,
PRIMARY KEY (`userid`)
);
SET character_set_client = @saved_cs_client;

--
-- Dumping data for table `hk_admin_info`
--


--
-- Table structure for table `hk_connect_memory`
--

SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `hk_connect_memory` (
`side1` bigint(20) unsigned NOT NULL,
`side2` bigint(20) unsigned NOT NULL,
`flags` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`side1`,`side2`)


以上是我导出的数所在..帮我看看有没有什么问题....
我是从5.0导出来的..我准备放到4.0中去...
WWWWA 2008-09-05
  • 打赏
  • 举报
回复
ini、 cnf 中试试
[mysql]
default-character-set=gb2312

[mysqld]
default-character-set=gb2312
luozhi9 2008-09-05
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 WWWWA 的回复:]
主要是字符集的设置,将两个版本的数据库、表的字符集设置为一致试试。
[/Quote]

我试用了gbk都不行..

我从5.0中导出数据库的时候.才用gbk导出..

在导入4.0还是提示..character_set_client = utf8 这里有错误...
WWWWA 2008-09-05
  • 打赏
  • 举报
回复
主要是字符集的设置,将两个版本的数据库、表的字符集设置为一致试试。

56,675

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧