mariadb設置utf8mb4

1 . mysql真正的utf8是utf8mb4纔是有效的utf8mysql

  a). mariaDB的設置方法      sql

#vim /etc/my.conf

[mysqld]
character_set_server=utf8mb4  
collation-server=utf8mb4_unicode_ci  
init_connect='SET NAMES utf8mb4'  
skip-character-set-client-handshake=true  

#/etc/init.d/mariadb reload

#驗證方法,登錄mysql
$SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

  

      b) mysql的設置方法  vim

#vim /etc/my.conf

[client] 
default-character-set = utf8mb4 
[mysql] 
default-character-set = utf8mb4 
[mysqld] 
character-set-client-handshake = FALSE 
character-set-server = utf8mb4 
collation-server = utf8mb4_unicode_ci 
init_connect='SET NAMES utf8mb4'

#/etc/init.d/mariadb reload

#驗證方法,登錄mysql
$SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';

  

相關文章
相關標籤/搜索