为何 my.cnf 内容是空的,数据库却可以运行

很奇怪的现象,my.cnf是空的,可mysql却可以运行。

my.cnf 根本就不在下面提示的这几个里面

mysql: option '-h' requires an argument
ben:5.6.26 soul$ mysql --help | grep my.cnf --color
                      order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf 
ben:5.6.26 soul$ 

my.cnf 只找到了一个,可他的内容却是空的

ben:~ soul$ sudo find / -name my.cnf
Password:
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/usr/local/Cellar/mysql/5.6.26/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/federated/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/ndb/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/ndb_big/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/ndb_binlog/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/ndb_rpl/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/ndb_team/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/rpl/extension/bhs/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/rpl/my.cnf
/usr/local/Cellar/mysql/5.6.26/mysql-test/suite/rpl_ndb/my.cnf
ben:~ soul$ 

my.cnf 全部内容如下,空的

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[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 = .....
# datadir = .....
# port = .....
# 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 
阅读 10.2k
1 个回答

my.cnf本来就不是必须的,不提供的话,mysqld取的是各选项的默认值。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏