老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業(yè)提供網(wǎng)站建設(shè)、域名注冊、服務(wù)器等服務(wù)

MySQL中文亂碼處理_字符集轉(zhuǎn)換處理

-- 中文亂碼修復(fù)

創(chuàng)新互聯(lián)建站主要從事成都網(wǎng)站設(shè)計、做網(wǎng)站、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)馬龍,10年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575

-- 查看MySQL服務(wù)參數(shù)設(shè)置
mysql> show variables like '%character%';
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.03 sec)

-- 查看建庫的默認(rèn)字符集
show create database test;

-- 查看建表的默認(rèn)字符集
show create table yjdb;

-- 修復(fù)為utf8字符集
ALTER DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE tb_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

-- root用戶執(zhí)行查詢,把結(jié)果執(zhí)行,把不統(tǒng)一的庫和表及字段的字符集統(tǒng)一為utf8
-- 修改全庫中建庫默認(rèn)字符集
select 'ALTER DATABASE '||db||' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' from mysql.db where db not in ('information_schema','mysql','test','performance_schema');
select concat('ALTER DATABASE ',db,' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;') from mysql.db where db not in ('information_schema','mysql','test','performance_schema');

-- 修改全庫中建表默認(rèn)字符集
select 'ALTER TABLE '||table_schema||'.'||table_name||' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;' as alter_sql from information_schema.TABLES where table_schema not in ('information_schema','mysql','test','performance_schema') and table_collation != 'utf8_general_ci';
select concat('ALTER TABLE ',table_schema,'.',table_name,' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;') as alter_sql from information_schema.TABLES where table_schema not in ('information_schema','mysql','test','performance_schema') and table_collation != 'utf8_general_ci';

-- 修改全庫中表的列屬性為latin1的字符集為默認(rèn),請確認(rèn)后執(zhí)行。
-- select * from information_schema.COLUMNS where table_schema='tss';
select 'alter table '||TABLE_SCHEMA||'.'||table_name||' change '||column_name||' '||column_name||' '||column_type||' default '||''''||column_default||''''||' comment '||''''||column_comment||''''||';' as alter_sql from information_schema.COLUMNS where table_schema not in ('information_schema','mysql','test','performance_schema') and CHARACTER_SET_NAME='latin1' and is_nullable='yes' and column_default is not null
union all
select 'alter table '||TABLE_SCHEMA||'.'||table_name||' change '||column_name||' '||column_name||' '||column_type||' comment '||''''||column_comment||''''||';' as alter_sql from information_schema.COLUMNS where table_schema not in ('information_schema','mysql','test','performance_schema') and CHARACTER_SET_NAME='latin1' and is_nullable='yes' and column_default is null
union all
select 'alter table '||TABLE_SCHEMA||'.'||table_name||' change '||column_name||' '||column_name||' '||column_type||' not null default '||''''||column_default||''''||' comment '||''''||column_comment||''''||';' as alter_sql from information_schema.COLUMNS where table_schema not in ('information_schema','mysql','test','performance_schema') and CHARACTER_SET_NAME='latin1' and is_nullable='no' and column_default is not null
union all
select 'alter table '||TABLE_SCHEMA||'.'||table_name||' change '||column_name||' '||column_name||' '||column_type||' not null '||' comment '||''''||column_comment||''''||';' as alter_sql from information_schema.COLUMNS where table_schema not in ('information_schema','mysql','test','performance_schema') and CHARACTER_SET_NAME='latin1' and is_nullable='no' and column_default is null;

-- 為了避免不同環(huán)境下出現(xiàn)誤差造成影響,可以在建庫和表的時候特殊指定字符集

-- 修改庫的編碼
select concat('ALTER DATABASE ',db,' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;') from mysql.db_view where db ='xjk_bbs';

-- 修改全庫中建表默認(rèn)字符集
select concat('ALTER TABLE ',table_schema,'.',table_name,' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;') as alter_sql from information_schema.TABLES where table_schema='xjk_bbs';

-- 修改全庫中表的列屬性為latin1的字符集為默認(rèn),請確認(rèn)后執(zhí)行。
-- select * from information_schema.COLUMNS where table_schema='tss';

select concat('alter table ',TABLE_SCHEMA,'.',table_name,' MODIFY COLUMN ',' ',column_name,' ',column_type,' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ',' default ','''',column_default,'''',' comment ','''',column_comment,'''',';') as alter_sql from information_schema.COLUMNS where table_schema='xjk_bbs' and table_name='aws_question' and column_type not like '%int%' and is_nullable='yes' and column_default is not null
union all
select concat('alter table ',TABLE_SCHEMA,'.',table_name,' MODIFY COLUMN ',' ',column_name,' ',column_type,' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ',' comment ','''',column_comment,'''',';') as alter_sql from information_schema.COLUMNS where table_schema='xjk_bbs' and table_name='aws_question' and column_type not like '%int%' and is_nullable='yes' and column_default is null
union all
select concat('alter table ',TABLE_SCHEMA,'.',table_name,' MODIFY COLUMN ',' ',column_name,' ',column_type,' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ',' not null default ','''',column_default,'''',' comment ','''',column_comment,'''',';') as alter_sql from information_schema.COLUMNS where table_schema='xjk_bbs' and table_name='aws_question' and column_type not like '%int%' and is_nullable='no' and column_default is not null
union all
select concat('alter table ',TABLE_SCHEMA,'.',table_name,' MODIFY COLUMN ',' ',column_name,' ',column_type,' CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci ',' not null ',' comment ','''',column_comment,'''',';') as alter_sql from information_schema.COLUMNS where table_schema='xjk_bbs' and table_name='aws_question' and column_type not like '%int%' and is_nullable='no' and column_default is null;


網(wǎng)站名稱:MySQL中文亂碼處理_字符集轉(zhuǎn)換處理
本文網(wǎng)址:http://www.xueling.net.cn/article/ipjdoh.html

其他資訊

在線咨詢
服務(wù)熱線
服務(wù)熱線:028-86922220
TOP
主站蜘蛛池模板: 综合精品久久久 | 久艹在线免费观看 | 精品一区二区三区成人精品 | 日本亚洲色大成网站ww | 精品久久国产老人久久综合 | 日本三级黄| 久久精品国产亚卅av嘿嘿 | 国产免费高清av | ww九九| 91久久精品国产一区二区三区 | 神马久久久久久久久久久 | 久久婷婷五月综合色国产 | 少妇久久久久久被弄到高潮 | 又黄又高潮的视频 | 国产精品久久久久国产a级 乱男乱女www7788 | 国产精品成人亚洲一区二区 | 国产精品高清一区二区三区 | 亚洲精品国产品国语原创 | 中文字幕色欲AV亚洲二区 | 性一乱一搞一交一伦一性 | 性高潮久久久久 | 亚洲欧美日韩愉拍自拍 | 成人性生交天码免费看 | 欧美三级不卡在线播放 | 曰本一道本久久88不卡 | 成人免费视频网址 | 久久久久国产成人免费精品免费 | 少妇性饥渴BBBBB搡BBBB | 午夜性刺激免费看视频 | jvid在线播放观看免费 | 17CC网黑料爆料一区二区三区 | 日韩精品亚洲精品 | 亚洲av中文无码乱人伦在线播放 | 成人永久免费网站在线观看 | 东京热加勒比波多野结衣 | 亚洲cb精品一区二区三区 | 嗯啊av| AV不卡在线永久免费观看 | 亚洲国产xxxx | 国产aⅴ精品一区二区三区久久 | 柠檬av导航 |