首页 > 数据库 >M1 安装MySql

M1 安装MySql

时间:2024-04-02 11:11:41浏览次数:22  
标签:MASTER buffer mysql M1 MySql MySQL master 安装 size

一:下载MySQL

下载地址:MySQL :: Download MySQL Community Server

  下载所需版本的dmg安装包,点击Archives可以选择历史版本:

 

  这里我选择安装8.0.31。注意:版本8.x.x中所有版本可以在安装过程中设置MySQL的密码,而之前的所有版本(比如5.7.X之类的),系统会在安装过程中弹出一个弹窗,自动生成一个临时密码(一定要记住,截图)

   下载完成后,双击打开.dmg文件

  

   再次双击安装包,即可安装:

  在后续安装过程中,不要更改默认安装路径,建议选择下面这个Use Legacy Password Encryption,如果选择上面那个,后续项目在VS Code或PyCharm中连接不成功,所以这里选择下面的:

 

之后设置密码,需要至少8位:

 

至此,MySQL 8.0.31安装完成,接下来是环境变量的配置。

  

环境变量配置

  在 bash_profile 添加环境变量

  alias mysql=/usr/local/mysql/bin/mysql

export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/support-files

 

 

配置my.cnf文件

sudo vim /etc/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  
# 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
————————————————
 

 

 

 

  

 

标签:MASTER,buffer,mysql,M1,MySql,MySQL,master,安装,size
From: https://www.cnblogs.com/shangwei/p/18110171

相关文章

  • 中文自然语言处理小白教程(二)——语料库的安装与使用
    自20世纪80年代以来,随着计算机应用技术的不断发展,世界各大语言都建立了许多不同规模、不同类型的语料库。这些语料库经过深度加工,应用范围也变得越来越广泛,在自然语言处理(NLP)中发挥着越来越重要的作用。因此,语料库已经成为了NLP的重要基础。本章将介绍语料库的基本概念、种类与......
  • ARM架构银河麒麟使用笔记-下载docker软件包及所有依赖包并在离线环境下安装
    ARM架构银河麒麟使用笔记-下载docker软件包及所有依赖包并在离线环境下安装arm银河麒麟aptdocker目的是在arm架构的银河麒麟操作系统V10中安装docker。一、给虚拟机创建快照1.创建qemu-imgsnapshot-cEmptyKylinrootfs.qcow22.查看qemu-imgsnapshot-lrootfs......
  • Ubuntu安装docker
    官网卸载系统docker,防止冲突forpkgindocker.iodocker-docdocker-composedocker-compose-v2podman-dockercontainerdrunc;dosudoapt-getremove$pkg;done卸载请参照docker卸载设置docker的apt仓库sudoapt-getupdatesudoapt-getinstallca-certificat......
  • Supervisor 安装与使用
    一、Supervisor介绍Supervisor是一个用Python编写的进程管理工具,它可以用于监控和控制类UNIX操作系统上的多个进程。它是一个客户端/服务器系统,其中Supervisor的服务器端称为supervisord,负责启动管理的子进程、响应客户端命令、重启崩溃或退出的子进程、记录子进程的st......
  • mysql -约束合集笔记
    SQL创建数据库createdatabaseschoolUSEschool#(数据库名)创建数据库表:createtablestudents(useridINTNOTNULLPRIMARYkey,lastnamevarchar(255),firstnamevarchar(255))#创建student数据库表且设置userid为主键)SQL约束:查看某个表已有的约束:#inform......
  • 【附源码】JAVA计算机毕业设计汪汪喵宠物寄养中心系统设计与开发(源码+mysql+文档)
    本系统(程序+源码)带文档lw万字以上  文末可领取本课题的JAVA源码参考系统程序文件列表系统的选题背景和意义选题背景:随着社会的发展和人们生活水平的提高,宠物已经成为越来越多家庭的重要成员。人们对宠物的关爱和投入也越来越多,这导致了宠物服务行业的迅速发展。其中,宠......
  • 【附源码】JAVA计算机毕业设计网上扶贫农产品销售系统(源码+mysql+文档)
    本系统(程序+源码)带文档lw万字以上  文末可领取本课题的JAVA源码参考系统程序文件列表系统的选题背景和意义随着互联网技术的迅速发展,传统的农产品销售模式已经不能满足现代消费者的需求。尤其是在扶贫领域,由于地理位置偏远、信息不对称等因素,贫困地区的农产品往往难以打......
  • 【附源码】JAVA计算机毕业设计网络安全知识学习系统(源码+mysql+文档)
    本系统(程序+源码)带文档lw万字以上  文末可领取本课题的JAVA源码参考系统程序文件列表系统的选题背景和意义选题背景:在信息技术飞速发展的今天,网络安全已经成为社会关注的热点问题。随着网络应用的普及和互联网技术的不断进步,网络攻击、数据泄露、恶意软件等安全威胁日......
  • 【附源码】JAVA计算机毕业设计网上购物系统(源码+mysql+文档)
    本系统(程序+源码)带文档lw万字以上  文末可领取本课题的JAVA源码参考系统程序文件列表系统的选题背景和意义选题背景:随着互联网技术的飞速发展,电子商务已经成为现代商业交易中不可或缺的一部分。网上购物系统作为电子商务平台的典型代表,以其便捷性、高效性和丰富的商品......
  • 【附源码】JAVA计算机毕业设计网上购物中心(源码+mysql+文档)
    本系统(程序+源码)带文档lw万字以上  文末可领取本课题的JAVA源码参考系统程序文件列表系统的选题背景和意义选题背景:随着互联网技术的飞速发展,电子商务已成为现代社会中不可或缺的一部分。网络购物因其便捷性、高效性和多样性,受到了广大消费者的喜爱。传统的购物方式需......