#!/bin/bash
# 创建程序目录
mkdir -p $PWD/{conf,data,log}
# 创建配置文件
tee $PWD/conf/my.cnf<<-'EOF'
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
# 实现mysql不区分大小(开发需求,建议开启)
lower_case_table_names=1
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
default-time_zone = '+8:00'
# [可选]日志设置
# error日志路径
# log-error=/var/log/mysql/error.log
# 开启慢查询 1:开启
# slow_query_log=1
# 定义3秒以上为慢查询
# long_query_time=3
# 慢查询日志路径
# slow-query-log-file=/var/log/mysql/slow.log
# 更改字符集 如果想Mysql在后续的操作中文不出现乱码,则需要修改配置文件内容
symbolic-links=0
# 服务端字符集
character-set-server=utf8mb4
# 字符集排序规则
collation-server=utf8mb4_unicode_ci
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
EOF