mysql5.5的参数和mysql5.0及5.1都不同!
修改mysql5.5的数据库编码格式为utf8:
在mysqld部分下加入:
character_set_server = utf8
collation-server=utf8_unicode_ci
init-connect='SET NAMES utf8'
修改表的字符集:
ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name;
或者如下:
修改整个库中的所有表的脚本如下:
more new.sh
#!/bin/bash
database=leo_wangpudb
host=-hlocalhost
user=-uroot
passwd=-p123456
for i in $(ls ./leo_wangpudb/|awk '{print $1}'|awk -F "." '{print $1}')
do
change_table="ALTER TABLE ${i} CONVERT TO CHARACTER SET utf8;"
mysql $user $passwd $host $database -e "${change_table}"
done
阅读(896) | 评论(0) | 转发(0) |