执行如下命令:/usr/local/mysql/bin/mysqld --verbose --help |grep -A 1 'Default options'
可能看到如下信息:
2019-04-14 19:18:23 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-04-14 19:18:23 0 [Note] mysqld (mysqld 5.6.42) starting as process 14944 ...
2019-04-14 19:18:23 14944 [Note] Plugin 'FEDERATED' is disabled.
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
2019-04-14 19:18:23 14944 [Note] Binlog end
2019-04-14 19:18:23 14944 [Note] Shutting down plugin 'MyISAM'
2019-04-14 19:18:23 14944 [Note] Shutting down plugin 'CSV'
上面信息中,etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf给出的几个目录,就是mysql依次查找配置文件的位置。
查找my.cnf文件路径; 从上可以看出, 服务器首先会读取/etc/my.cnf文件,如果发现该文件不存在,再依次尝试从后面的几个路径进行读取。 参数详解:[client] #客户端设置,即客户端默认的连接参数 port = 3307 #默认连接端口 socket = /data/mysqldata/3307/mysql.sock #用于本地连接的socket套接字 default-character-set = utf8mb4 #编码 [mysqld] #服务端基本设置 port = 3307 MySQL监听端口 socket = /data/mysqldata/3307/mysql.sock #为MySQL客户端程序和服务器之间的本地通讯指定一个套接字文件 pid-file = /data/mysqldata/3307/mysql.pid#pid文件所在目录 basedir = /usr/local/mysql-5.7.11#使用该目录作为根目录(安装目录) datadir = /data/mysqldata/3307/data #数据文件存放的目录 tmpdir = /data/mysqldata/3307/tmp #MySQL存放临时文件的目录 character_set_server = utf8mb4 #服务端默认编码(数据库级别) collation_server = utf8mb4_bin #服务端默认的比对规则,排序规则 user = mysql #MySQL启动用户 log_bin_trust_function_creators = 1 #This variable applies when binary logging is enabled. It controls whether stored function creators can be trusted not to create stored functions that will cause #unsafe events to be written to the binary log. If set to 0 (the default), users are not permitted to create or alter stored functions unless they have the SUPER #privilege in addition to the CREATE ROUTINE or ALTER ROUTINE privilege. 开启了binlog后,必须设置这个值为1.主要是考虑binlog安全 performance_schema = 0 #性能优化的引擎,默认关闭 secure_auth = 1 #secure_auth 为了防止低版本的MySQL客户端(欢迎分享,转载请注明来源:内存溢出
评论列表(0条)