转自https://www.jianshu.com/p/628bcf8bb557

As of MySQL 5.7.18, my-default.ini is no longer included in or installed by distribution packages.

MySQL不再自带默认配置文件

手动写一个就好了

cd /etc

sudo vim my.cnf

# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an 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 files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
default-character-set=utf8
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
character-set-server=utf8
init_connect='SET NAMES utf8
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character-set-server=utf8
init_connect='SET NAMES utf8'
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will 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 is not set
# but will not function as a master if omitted
server-id = 1 # Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# 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:
#
# CHANGE MASTER 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 example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will 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 that reason, you may want to leave the lines below untouched
# (commented) and instead use 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 is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-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 are 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_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50 [mysqldump]
quick
max_allowed_packet = 16M [mysql]
no-auto-rehash
# Remove the next comment character if you are not 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

Mac下MySQL无my-default.cnf的更多相关文章

  1. MAC下 mysql不能插入中文和中文乱码的问题总结

    MAC下 mysql不能插入中文和中文乱码的问题总结 前言 本文中所提到的问题解决方案,都是基于mac环境下的,但其他环境,比如windows应该也适用. 问题描述 本文解决下边两个问题: 往mysq ...

  2. mac下mysql数据库的配置

    这里记录一下. 之前在mac下使用brew install mysql安装,但是安装完成后发现密码不好修改,上网搜了下发现mac下使用命令行安装mysql确实存在很多问题,这一点确实远不如Ubuntu ...

  3. Mac下MySQL卸载方法 转载

    mac下mysql的DMG格式安装内有安装文件,却没有卸载文件……很郁闷的事. 网上搜了一下,发现给的方法原来得手动去删. 很多文章记述要删的文件不完整,后来在stackoverflow这里发现了一个 ...

  4. MAC下 mySQL及workbench安装

    1.首先去mysql 网站下载安装包,https://dev.mysql.com/downloads/mysql/ 选择第一个.dmg格式的下载安装 2.安装完成后,在System Preferenc ...

  5. Mac下MySQL卸载方法

    mac下mysql的DMG格式安装内有安装文件,却没有卸载文件……很郁闷的事.1 sudo rm /usr/local/mysql2 sudo rm -rf /usr/local/mysql*3 su ...

  6. MAC下MySQL忘记初始密码

    MAC下MySQL忘记初始密码的解决方法分享给大家,供大家参考,具体内容如下 从官网安装好MySQL的dmg后. 1 设置mysql命令 从终端输入 ? 1 mysql --version 若显示版本 ...

  7. MAC下MySQL初始密码忘记修改初始密码

    解决MAC下MySQL忘记初始密码的方法分享给大家,供大家参考,具体内容如下 第一步: 点击系统偏好设置->最下边点MySQL,在弹出页面中,点击stop MySQL Servier,输入密码关 ...

  8. MAC下MySQL初始密码忘记怎么办

    解决MAC下MySQL忘记初始密码的方法分享给大家,供大家参考,具体内容如下 第一步: 点击系统偏好设置->最下边点MySQL,在弹出页面中,关闭服务 第二步:进入终端输入:cd /usr/lo ...

  9. Mac下Mysql配置

    安装 http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.6/mysql-5.6.41-macos10.13-x86_ ...

随机推荐

  1. 柔弱的APP如何自我保护,浅谈APP防御手段,使用360加固助手加固/签名/多渠道打包/应用市场发布

    柔弱的APP如何自我保护,浅谈APP防御手段,使用360加固助手加固/签名/多渠道打包/应用市场发布 由于JAVA和Android的平台型,所以APP很容易被反编译,这对于我们开发者来说,是一个不想要 ...

  2. 9.2.1、Libgdx的输入处理之轮询

    (官网:www.libgdx.cn) 轮询是检测输入设备的当前状态,比如特定的按键按下,屏幕第一个手指的位置等等.这是一个快速简单的处理用户输入的方式,并且应用到很多的游戏中. 注意:如果你处理轮询, ...

  3. 【一天一道LeetCode】#47. Permutations II

    一天一道LeetCode系列 (一)题目 Given a collection of numbers that might contain duplicates, return all possibl ...

  4. javascript 实战总结

    JavaScript的简单的知识前面已经总结  欢迎交流学习,学习靠的是理论+实践,  通过姜昊老师的JavaScript专题训练,加深了对理论知识的理解,学习新的语言越来越发现熟悉的背景,基础内容是 ...

  5. LeetCode之“树”:Sum Root to Leaf Numbers

    题目链接 题目要求: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represe ...

  6. 数据库用户映射到SQL Server登录名

    由于不是固定在一如电脑开始,经常需要把数据备份与恢复.或者是帮助客户修改程序,接收到客户备份好的数据,需要在电脑恢复. 这样就需要将数据库用户映射到 SQL Server 登录名.如何映射?可使用下面 ...

  7. SpriteBuilder中频繁的切换场景层的解决办法

    注意,不像SettingsLayer,CCScrollView实例并没有从场景中删除和重新加载像代码所示的那样. 你只是简单的改变其可视(visible)状态on和off. 改变可视状态比加载CCB或 ...

  8. Spring--FileSystemXmlApplicationContext

    //从文件系统或者统一定位资源中获得上下文的定义 public class FileSystemXmlApplicationContext extends AbstractXmlApplication ...

  9. 速度之王 — LZ4压缩算法(二)

    LZ4 (Extremely Fast Compression algorithm) 项目:http://code.google.com/p/lz4/ 作者:Yann Collet 本文作者:zhan ...

  10. XMPP系列(三)---获取好友列表、添加好友

    1.心跳检测.掉线重连功能 客户端和服务器端都可以设置多久发送一次心跳包,如果对方没有返回正确的pong信息,则会断开连接,而添加掉线重连功能,则会自动进行连接. 如果自己写聊天功能还得自己做心跳检测 ...