日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

设置mysql默认字符集_MySQL之修改默认引擎和字符集

發(fā)布時(shí)間:2023/11/27 生活经验 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 设置mysql默认字符集_MySQL之修改默认引擎和字符集 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、數(shù)據(jù)庫引擎

1.1 查看數(shù)據(jù)庫引擎

mysql> show engines;

+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+

| Engine | Support | Comment | Transactions | XA | Savepoints |

+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+

| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |

| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |

| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |

| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |

| MyISAM | YES | MyISAM storage engine | NO | NO | NO |

| CSV | YES | CSV storage engine | NO | NO | NO |

| ARCHIVE | YES | Archive storage engine | NO | NO | NO |

| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |

| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |

+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+

9 rows in set (0.00 sec)

可以看到默認(rèn)引擎是 InnoDB。

1.2 修改默認(rèn)數(shù)據(jù)庫引擎

1.打開配置文件

[root@VM_0_15_centos ~]# vim /etc/my.cnf

2.在最下面編輯如下內(nèi)容:

default-storage-engine=InnoDB

3.重啟服務(wù)

[root@VM_0_15_centos ~]# systemctl restart mysqld

二、數(shù)據(jù)庫字符集

2.1 查看字符集

查看MYSQL數(shù)據(jù)庫服務(wù)器和數(shù)據(jù)庫字符集

mysql> show variables like '%character%';

+--------------------------+----------------------------+

| Variable_name | Value |

+--------------------------+----------------------------+

| character_set_client | utf8 |

| character_set_connection | utf8 |

| character_set_database | latin1 |

| character_set_filesystem | binary |

| character_set_results | utf8 |

| character_set_server | latin1 |

| character_set_system | utf8 |

| character_sets_dir | /usr/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.01 sec)

字符集

作用

character_set_client

用來設(shè)置客戶端使用的字符集。

character_set_connection

用來設(shè)置連接數(shù)據(jù)庫時(shí)的字符集

character_set_database

用來設(shè)置默認(rèn)創(chuàng)建數(shù)據(jù)庫的編碼格式

character_set_filesystem

文件系統(tǒng)的編碼格式,把操作系統(tǒng)上的文件名轉(zhuǎn)化成此字符集,默認(rèn)binary是不做任何轉(zhuǎn)換的

character_set_results

查詢結(jié)果字符集

character_set_server

服務(wù)器安裝時(shí)指定的默認(rèn)編碼格式

character_set_system

系統(tǒng)元數(shù)據(jù)(字段名等)字符集

character_sets_dir

字符集安裝的目錄

查看 MYSQL 所支持的字符集

show charset;

查看庫的字符集

show database status from 庫名 like 表名;

查看表的字符集

show table status from 庫名 like 表名;

查看表中所有列的字符集

show full columns from 表名;

2.2 修改字符集

1.打開配置文件

[root@VM_0_15_centos ~]# vim /etc/my.cnf

2.在最下面編輯如下內(nèi)容:

character-set-server=utf8

[client]

default-character-set=utf8

3.重啟服務(wù)并驗(yàn)證

[root@VM_0_15_centos ~]# systemctl restart mysqld

[root@VM_0_15_centos ~]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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/share/mysql/charsets/ |

+--------------------------+----------------------------+

8 rows in set (0.00 sec)

總結(jié)

以上是生活随笔為你收集整理的设置mysql默认字符集_MySQL之修改默认引擎和字符集的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。