配置my.cnf
来源:互联网 发布:房地产文案 知乎 编辑:程序博客网 时间:2024/05/19 22:06
默认的my.cnf文件:
[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
修改后的my.cnf文件:
[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# Default directory.
datadir=/var/lib/mysql
# The TCP/IP Port the MySQL Server listens on.
port=3306
bind-address=127.0.0.1
# The Linux Socket the MySQL Server uses when not using a listener.
# socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# The default storage engine that will be used when createing new tables.
default-storage-engine=INNODB
# Set the SQL mode to strict.
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# Set the maximum number of connections.
max_connections=100
# Set the number of open tables for all threads.
table_cache=256
# Set the maximum size for internal (in-memory) temporary tables.
tmp_table_size=26M
# Set how many threads should be kept in a cache for reuse.
thread_cache_size=8
# MyISAM configuration.
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=52M
key_buffer_size=36M
read_rnd_buffer_size=256K
sort_buffer_size=256K
# InnoDB configuration.
innodb_data_home_dir=/var/lib/mysql
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=25M
innodb_log_file_size=5M
innodb_thread_concurrency=8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
启动服务后,需要对MySQL Server进行一些安全加固,该脚本位于/usr/bin目录下:
【 ~】$ mysql_secure_installation
这个脚本需要交互性地回应几个提示。第一个提示要求输入root密码,该密码最初是空的。这意味着按回车键即可。下一个问题询问是否要设置root用户的密码。
按Y键和回车键。脚本将提示输入两次root用户的密码。
然后再问是否要删除匿名用户,这是一个必做的项目,按Y键和回车键。下一个问题问是否想不允许root登录。如果这是一个开发机器,那么就应该按Y键和
回车键来限制root登录到本地主机。
然后脚本会问是否想要删除test数据库,是否删除它确实并不重要,但是我建议删除。按Y键和回车键删除测试数据库。最后一个问题问是否要重载权限表,
答案是按Y键和回车键。这将清除现有的安全特权,并重新载入它们,这些重新载入的特权中带有任何在连接MySQL数据库时产生的变化,这一替代需要断开
连接,关闭并重启MySQL实例。
加固数据库后,应该创建一个student用户和studentdb数据库。
- my.cnf配置详解
- My.cnf配置选项
- My.cnf 配置选项
- my.cnf配置详解
- mysql my.cnf 配置
- my.cnf配置
- my.cnf配置详解
- my.cnf默认配置
- 配置my.cnf
- my.cnf的配置
- my.cnf推荐配置
- my.cnf配置优化
- MY.CNF配置(转载)
- mysql my.cnf 配置建议
- Mysql 配置 my.cnf 详解
- mysql my.cnf 配置建议
- MySQL 5.6 my.cnf 配置
- my.cnf配置参数介绍
- uva 10003 Cutting Sticks(区间DP)
- java 空字符串与null区别
- assign和weak的区别
- 华为在线训练之16进制转换10进制
- HDU - 2087 剪花布条(Kmp)
- 配置my.cnf
- fspecial()函数解析
- Java分页
- 思维导图教你看懂----------Java IO流
- MySQL优化总结(一):常用优化思路和临时表
- 《jQuery从入门到精通》第二节 开始使用jQuery(二)
- Splash Scrapyjs Connection was refused by other side: 111: Connection refused.
- ss命令使用示例
- 学会Retrofit,你可以参考的文章