mysql数据库升级,解决字符集问题

很文博客hinven.com 数据库评论190字数 478阅读模式
广告也精彩

软件升级部分就不说了,光说数据库迁移。

1、从4.0中导出表 mysqldump –no-data -uroot -p database > struct.sql文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

2、导出数据 mysqldump –no-create-info=true –extended-insert=false -u root -p database > data.sql文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

3、用vi编辑struct.sql, 使用最末行命令文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

:%s/) TYPE=MyISAM;/) ENGINE=MyISAM DEFAULT CHARSET=gbk;/g文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

:%s/) TYPE=HEAP.*$/) ENGINE=MEMORY DEFAULT CHARSET=gbk;/g文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

4、导入struct.sql,data.sql文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

mysql 4.0及之前的版本,都是只支持一种字符集latin1,从mysql 4.1起,支持众多的字符集,比如gbk,utf8(非utf-8)等。文章源自很文博客https://www.hinven.com很文博客-https://www.hinven.com/50335.html

gbk,utf8等多字节字符集的存储也发生了变化,比如latin1下,汉字字长是2,在gbk或utf8下,汉字字长就是1。也就是说原来varchar(32)只能存16个汉字,现在能保存32个了。

工具:作品在线观看

女优:最新作品观看

中文:国语在线观看

weinxin
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
 
广告也精彩
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证