mysql4.0 upgrade to mysql5 of 4.1 to resolve character set issues

  • 2020-05-09 19:27:29
  • OfStack

1. Export the table mysqldump from 4.0. no-data-uroot-p database > struct.sql
2. Export data mysqldump -- no-create-info =true -- extended-insert = false-u root-p database > data.sql
3. Edit struct.sql with vi, using the last command
:%s/) TYPE=MyISAM;/) ENGINE=MyISAM DEFAULT CHARSET=gbk;/g
:%s/) TYPE=HEAP.*$/) ENGINE=MEMORY DEFAULT CHARSET=gbk;/g

4, import struct sql, data. sql

mysql 4.0 and previous versions only support one character set, latin1. Starting from mysql 4.1, gbk,utf8(not utf-8) and so on are supported.
The storage of multi-byte character sets such as gbk and utf8 has also changed. For example, under latin1, the length of Chinese characters is 2, while under gbk or utf8, the length of Chinese characters is 1. That is to say, varchar(32) can save 32 Chinese characters instead of just 16.

Address: http: / / www. xiaojb. com archives/it/mysqludate shtml

Related articles: