欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL修改默認(rèn)引擎和字符集詳情

 更新時間:2021年09月23日 09:11:56   作者:markLogZhu  
這篇文章小編主要介紹的是MySQL修改默認(rèn)引擎和字符集的相關(guān)資料,需要的小伙伴請參考下面文章的具體內(nèi)容,希望能否幫助到您

一、數(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ù)庫時的字符集
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ù)器安裝時指定的默認(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)

到此這篇關(guān)于MySQL修改默認(rèn)引擎和字符集詳情的文章就介紹到這了,更多相關(guān)MySQL修改默認(rèn)引擎和字符集內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Mysql服務(wù)添加 iptables防火墻策略的方案

    Mysql服務(wù)添加 iptables防火墻策略的方案

    這篇文章主要介紹了給Mysql服務(wù)添加 iptables防火墻策略的方案,本文給大家分享兩種解決方案,需要的朋友可以參考下
    2021-04-04
  • JDBC連接mysql8和mysql5.7的注意事項(xiàng)

    JDBC連接mysql8和mysql5.7的注意事項(xiàng)

    這篇文章主要介紹了JDBC連接mysql8和mysql5.7的注意事項(xiàng),具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-09-09
  • mysql 常用數(shù)據(jù)庫語句 小練習(xí)

    mysql 常用數(shù)據(jù)庫語句 小練習(xí)

    一個mysql小練習(xí) 建表 查詢 修改表 增加字段 刪除字段
    2009-07-07
  • 解決mysql數(shù)據(jù)庫導(dǎo)入sql文件不成功的問題

    解決mysql數(shù)據(jù)庫導(dǎo)入sql文件不成功的問題

    這篇文章主要介紹了解決mysql數(shù)據(jù)庫導(dǎo)入sql文件不成功的問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • MySQL的表空間是什么

    MySQL的表空間是什么

    這篇文章主要介紹了MySQL的表空間是什么,幫助大家更好的理解和使用MySQL表的相關(guān)知識,感興趣的朋友可以了解下
    2020-11-11
  • Mysql 數(shù)據(jù)庫雙機(jī)熱備的配置方法

    Mysql 數(shù)據(jù)庫雙機(jī)熱備的配置方法

    mysql數(shù)據(jù)庫沒有增量備份的機(jī)制,當(dāng)數(shù)據(jù)量太大的時候備份是一個很大的問題。還好mysql數(shù)據(jù)庫提供了一種主從備份的機(jī)制,其實(shí)就是把主數(shù)據(jù)庫的所有的數(shù)據(jù)同時寫到備份數(shù)據(jù)庫中。
    2010-06-06
  • MySQL索引優(yōu)化之適合構(gòu)建索引的幾種情況詳解

    MySQL索引優(yōu)化之適合構(gòu)建索引的幾種情況詳解

    我們知道正確的建立索引可以加快數(shù)據(jù)庫的查詢,但是如果索引建立不當(dāng),或者隨意的建立過多索引不僅不會提升數(shù)據(jù)庫的效率,反而在進(jìn)行數(shù)據(jù)更新操作的時候需要耗費(fèi)系統(tǒng)資源對索引進(jìn)行維護(hù),同時占用大量的存儲空間來對索引進(jìn)行存儲,本文主要講述在哪些情況下適合建立索引
    2022-07-07
  • Mysql的SELECT語句與顯示表結(jié)構(gòu)詳解

    Mysql的SELECT語句與顯示表結(jié)構(gòu)詳解

    這篇文章主要介紹了Mysql的SELECT語句與顯示表結(jié)構(gòu)詳解的相關(guān)資料,需要的朋友可以參考下
    2023-01-01
  • MySQL中索引與視圖的用法與區(qū)別詳解

    MySQL中索引與視圖的用法與區(qū)別詳解

    索引與視圖是我們在日常使用mysql必不可少的一部分,最近在學(xué)習(xí)中看到一本書中關(guān)于這方法寫的不錯,所以這篇文章主要給大家介紹了關(guān)于MySQL中索引與視圖的使用與區(qū)別的相關(guān)資料,需要的朋友可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-11-11
  • MySQL普通表如何轉(zhuǎn)換成分區(qū)表

    MySQL普通表如何轉(zhuǎn)換成分區(qū)表

    分表和表分區(qū)的目的就是減少數(shù)據(jù)庫的負(fù)擔(dān),提高數(shù)據(jù)庫的效率,通常點(diǎn)來講就是提高表的增刪改查效率,下面這篇文章主要給大家介紹了關(guān)于MySQL普通表如何轉(zhuǎn)換成分區(qū)表的相關(guān)資料,需要的朋友可以參考下
    2022-05-05

最新評論