Transfer from https://www.jianshu.com/p/628bcf8bb557
As of MySQL 5.7.18, is my-default.ini
no longer included in or installed by distribution packages.
MySQL no longer comes with the default configuration file
Just write one manually.
Cd/etc
sudo vim my.cnf
# Example MySQL config file for medium systems. # # for-a system with little memory (32m-64m) where MySQL plays # a important part, or systems up to 128M Where MySQL is used together with # Other programs (such as a Web server) # # MySQL programs look for option fil Es in a set of # locations which depend on the deployment platform. # can copy this option file to one of those # locations. For the information about these locations, see: # http://dev.mysql.com/doc/mysql/en/option-files.html # # in this fil E, you can use the all long options, which a program supports. # If you want to know which options a program supports, run the program # with the "--help" option. # The following options would be passed to all MySQL clients [client] Default-character-set=utf8 #password = Your_pa ssWOrd Port = 3306 socket =/tmp/mysql.sock # Here follows entries for some specific programs # T He MySQL server [mysqld] CharacTer-set-server=utf8 init_connect= ' Set NAMES UTF8 port = 3306 socket =/tmp/mysql.sock Skip-external-lo cking key_buffer_size = 16M Max_allowed_packet = 1M Table_open_cache = sort_buffer_size = 512K Net_buffe R_length = 8K Read_buffer_size = 256K Read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M character-set-s Erver=utf8 init_connect= ' SET NAMES UTF8 ' # Don ' t listen on a TCP/IP port at all. This can is a security enhancement, # If all processes that need to connect to mysqld run on the same host. # All interaction with Mysqld must is made via Unix sockets or named pipes. # Note that using this option without enabling named Pipes on Windows # (via the "enable-named-pipe" option) would render Mysqld useless! # #skip-networking # Replication Master Server (default) # Binary logging is required for Replication Log-bin =mysql-bin # Binary Logging format-mixed recommended binlog_format=mixed# required Unique ID between 1 and 2^32-1 # defaults to 1 if Master-host isn't set # but would not functio N as a master if omitted Server-id = 1 # Replication Slave (Comment out master sections to use this) # To configure the host as a replication slave, you can choose between # both methods: # # 1) Use the Change Master to command (fully described in our manual)-# The syntax are: # # Change Master To master_host=<Host>, master_port=<Port>, # master_user=<User>, master_password=<Password> ; # # where you replace<Host>,<User>,<Password>by quoted strings and #<Port> By the master's port number (3306 by default). # # # # # # # # # # # # # # Example to master_host= ' 125.564.12.1 ', master_port=3306, # Master_user = ' Joe ', master_password= ' secret '; # # OR # # 2) Set the variables below. However, in case you choose this method, then # Start replication for the first time (even unsuccessfully, for Exa Mple # If you mistyped the password with Master-password and the slave fails to # Connect), the slave would c reate a master.info file, and any later # change in this file to the variables ' values below'll be ignored and # Overridden by the content of the Master.info file, unless you shutdown # The slave server, delete master. Info and restart the slaver server. # for this reason, want to leave the lines below untouched # (commented) and instead with change MASTER to (see above) # # required Unique ID between 2 and 2^32-1 # (anD different from the Master) # defaults to 2 if master-host are set # but would not function as a slave if omitted #server-id = 2 # # The replication master for this slave-required #master-host =<hostname># # The username the slave would use for authentication when connecting # to the master-required #master-user =<username># # The password the slave would authenticate with when connecting to # the master-required #mas Ter-password =<Password># # The Port the master is listening on. # optional-defaults to 3306 #master-port =<Port> # # Binary Logging-not required for slaves, but recommended #log-bin=mysql-bin # uncomment The following if you is using InnoDB tables #innodb_data_home_dir =/usr/local/mysql/data #innodb_data_file _path = Ibdata1:10m:autoextend #innodb_log_group_home_dir =/usr/local/mysql/data # you can set. _buffer_pool_size up to 50-80% # of RAM but beware of setting memory usage too high #innodb_buffer_pool_s ize = 16M #innodb_additional_mem_pool_size = 2M # Set: _log_file_size to% of buffer pool size #innodb_log_file_size = 5M #innodb_log_buffer_size = 8M #i Nnodb_flush_log_at_trx_commit = 1 #innodb_lock_wait_timeout = [Mysqldump] Quick Max_allowed_packet = 16M [MySQL] no-auto-rehash # Remove the next comment ch Aracter if familiar with SQL #safe-updates default-cHaracter-set=utf8 [Myisamchk] key_buffer_size = 20M Sort_buffer_size = 20M Read_buffer = 2M Write_buffer = 2M [Mysqlhotcopy] Interactive-timeout
MySQL no my-default.cnf under Mac