MYSQL 、/etc/my.cnf
7配置参数 # bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql --defaults-file=/etc/my.cnf
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
alter user 'root'@'localhost' identified by 'Szyq1234';
update mysql.user set host="%" where user="root";
select user,host from mysql.user where='root';
flush privileges;
mysqld --defaults-file=/etc/my.cnf --user=root
alter user 'root'@'%' identified with mysql_native_password by 'Szyq1234';
For advice on how to change settings please see
http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
* DO NOT EDIT THIS FILE. It‘s a template which will be copied to the
* default location during install, and will be replaced if you
* upgrade to a newer version of MySQL.
[mysqld]
Remove leading # and set to the amount of RAM for the most important data
cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
Remove leading # to turn on a very important data integrity option: logging
changes to the binary log between backups.
log_bin
These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /data/mysql
port = 3307
server_id = .....
socket = .....
Remove leading # to set options mainly useful for reporting servers.
The server defaults are faster for transactions and fast SELECTs.
Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
~ ######################################################
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
Mysql服务的唯一编号 每个mysql服务Id需唯一
server-id = 1
服务端口号 默认3306
port = 3306
mysql安装根目录
basedir = /opt/mysql
mysql数据文件所在位置
datadir = /opt/mysql/data
临时目录 比如load data infile会用到
tmpdir = /tmp
设置socke文件所在目录
socket = /tmp/mysql.sock
主要用于MyISAM存储引擎,如果多台服务器连接一个数据库则建议注释下面内容
skip-external-locking
只能用IP地址检查客户端的登录,不用主机名
skip_name_resolve = 1
事务隔离级别,默认为可重复读,mysql默认可重复读级别(此级别下可能参数很多间隙锁,影响性能)
transaction_isolation = READ-COMMITTED
数据库默认字符集,主流字符集支持一些特殊表情符号(特殊表情符占用4个字节)
character-set-server = utf8mb4