MYSQL 、/etc/my.cnf
7配置参数 # bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql --defaults-file=/etc/my.cnfhtml
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=rootmysql
alter user 'root'@'%' identified with mysql_native_password by 'Szyq1234';sql
For advice on how to change settings please see
* 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 = 3307markdown
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 = 2Msocket
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
~ ######################################################ide
[client]
port = 3306
socket = /tmp/mysql.sock性能
[mysqld]ui
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
数据库字