`

MAC配置MySQL my.cnf配置文件

 
阅读更多
1,在 /etc 新建 my.cnf 文件

sudo vim my.cnf
2,将如下配置内容写入到文件中

# 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

3,设置权限

sudo chmod 664 /etc/my.cnf
4,重启mysql

系统偏好设置-> MySQL 重新启动
分享到:
评论

相关推荐

    ubuntu mysql my.cnf 服务器最佳配置

    ubuntu mysql my.cnf 服务器最佳配置(16G,32G 内存)

    mysql5.7用的配置文件my.cnf

    mysql5.7用的配置文件,完成了基本的调优选项,并注释了需要自行调整参数的计算公式,使用时请自行重命名为my.cnf。如配合我上传的自动安装脚步mysql7install.sh一起使用则无需重命名,配置在对应的http服务上使用...

    linux下mysql配置文件my.cnf详解.pdf

    linux下mysql配置文件my.cnf详解.pdf linux下mysql配置文件my.cnf详解.zip dba基础

    linux下mysql my.cnf 文件

    linux下mysql my.cnf 文件已经配置好 路径根据实际情况自己修改linux下mysql my.cnf 文件已经配置好 路径根据实际情况自己修改linux下mysql my.cnf 文件已经配置好 路径根据实际情况自己修改

    MySQL中配置文件my.cnf因权限问题导致无法启动的解决方法

    本文主要给大家介绍了关于MySQL中配置文件my.cnf因权限问题导致无法启动的相关解决过程,分享出来供大家参考学习,下面来一起看看详细的介绍: 问题描述 MySQL 无法启动,报如下错误: 问题分析 查看 MySQL 错误...

    MySQL各版本my.cnf配置文件.rar

    MySQL 5.6、5.7、8.0版本的my.cnf完整配置文件,亲测可用,配置文件中优化了MySQL中的一些默认配置项,能够有效的提高MySQL数据库的并发处理能力!

    MySQL 8.0 的详细 配置 my.cnf

    MySQL 教程 MySQL 是最流行的关系型数据库管理系统,在 WEB 应用方面 MySQL 是最好的 RDBMS(Relational Database Management System:关系数据库 MySQL8.0数据库的一般配置 Linux环境的配置文件

    mysql5.7 my.cnf配置文件优化

    mysql5.7优化后的配置文件,mysql5.7主从架构配置环境,生产环境直接使用,推荐生产环境5.7版本使用最稳定版本5.7.21。

    mysql配置文件my.cnf

    mysql配置文件my.cnf,经常由于mysql升级后,默认没有此配置文件,上传以备份,根据个人需求,手动修改改文件,放置于/etc/my.cnf处,重启mysql生效

    mysql数据库my.cnf配置文件

    # 注:这两个参数不支持动态改变,需要把该参数加入到my.cnf里,修改完后重启MySQL服务,允许值的范围从 1-64 innodb_thread_concurrency = 0 # 默认设置为 0,表示不限制并发数,这里推荐设置为0,更好去发挥CPU多核...

    mysql-5.7.24的my.cnf

    mysql-5.7.24的my.cnf。适用于生产环境。相关配置已经写好,直接可以用。 mysql-5.7.24的my.cnf。适用于生产环境。相关配置已经写好,直接可以用。 mysql-5.7.24的my.cnf。适用于生产环境。相关配置已经写好,直接...

    mysql数据库my.cnf配置文件注释详解

    mysql数据库my.cnf配置文件注释详解

    linux下mysql配置文件my.cnf详解

    Linux 下 Mysql 配置文件 my.cnf 详解 Mysql 配置文件 my.cnf 是 Mysql 数据库服务器的核心配置文件,在 Linux 下 plays a crucial role in configuring Mysql 服务器的行为。该文件中包含了多个配置选项,这些选项...

    大型电商 生产环境的 Mysql配置文件 my.cnf

    某电商网站的生产环境的Mysql配置文件,放入/etc/下面即可

    Linux MySQL基础配置文件my.cnf

    Linux环境, 通过编辑my.cnf文件,设置MySQL数据库字符集,centos6.5 安装MySQL 5.7.21 ,没有找到my.cnf文件,此文件为基础配置文件

    MySQL my.cnf配置文件完美详解

    MySQL my.cnf配置文件完美详解

    官方mysql的docker镜像,自定义配置文件my.cnf

    官方mysql的docker镜像,自定义配置文件启动,附件中是自定义的配置文件,里面配置了端口和各种其他参数,便于维护

    MySQL配置文件my.cnf中文版

    MySQL配置文件my.cnf中文版.doc

    MySQL中my.cnf文件选项

    MySQL中my.cnf文件选项 MySQL中my.cnf文件选项 MySQL中my.cnf文件选项

    mysql 配置文件my.cnf

    mysql 配置文件my.cnf模板。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

Global site tag (gtag.js) - Google Analytics