查看配置文件: locate my.cnf
/etc/alternatives/my.cnf
/etc/mysql/my.cnf
/etc/mysql/my.cnf.fallback
一. ubuntu下mysql安裝布局:
- 客戶端程序:/usr/bin/mysql
- 服務(wù)器程序:/usr/sbin/mysqld
- 數(shù)據(jù)庫(kù)和日志文件:/var/lib/mysql
- 配置文件:/etc/mysql/my.cnf (全局)或者~/.my.cnf(針對(duì)用戶)
- 啟動(dòng)mysql服務(wù)器:/etc/init.d/mysql
二蛹磺、配置 my.cnf文件
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
# 設(shè)置3306端口
port=3306
# 設(shè)置mysql的安裝目錄
# basedir=/usr/local/mysql
# 設(shè)置mysql數(shù)據(jù)庫(kù)的數(shù)據(jù)的存放目錄
# datadir= /var/lib/mysql
# 允許最大連接數(shù)
max_connections=200
# 允許連接失敗的次數(shù)宝恶。這是為了防止有人從該主機(jī)試圖攻擊數(shù)據(jù)庫(kù)系統(tǒng)
max_connect_errors=10
# 服務(wù)端使用的字符集默認(rèn)為UTF8
character-set-server=utf8mb4
#使用–skip-external-locking MySQL選項(xiàng)以避免外部鎖定方淤。該選項(xiàng)默認(rèn)開(kāi)啟
external-locking = FALSE
# 創(chuàng)建新表時(shí)將使用的默認(rèn)存儲(chǔ)引擎
default-storage-engine=INNODB
# 默認(rèn)使用“mysql_native_password”插件認(rèn)證
default_authentication_plugin=mysql_native_password
[mysqld_safe]
log-error=error.log
#pid-file=mysqld.pid
# 定義mysql應(yīng)該支持的sql語(yǔ)法,數(shù)據(jù)校驗(yàn)
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysql]
# 設(shè)置mysql客戶端默認(rèn)字符集
default-character-set=utf8mb4
[client]
# 設(shè)置mysql客戶端連接服務(wù)端時(shí)默認(rèn)使用的端口
port=3306
default-character-set=utf8mb4