Mac的arm架构芯片安装mysql8和安装中的问题

  1. 下载mysql
    地址:https://dev.mysql.com/downloads/mysql/
  2. 解压到某个地方
  3. 在support-files 文件夹下面新建 my.conf 配置文件,内容如下
[client]
  default-character-set=UTF8MB3
  #password   = your_password
  port        = 3306
  #修改的socket文件的位置,默认是走的/tmp下的mysql.sock会有冲突
  #这是报错  Another process with pid 77346 is using unix socket file.
  #客户端也需要这个和服务端的一致
  socket      = /Users/yaoqiang/app/mysql-8.0.31/mysql.sock
[mysqld]
  #innodb_force_recovery = 1
  event_scheduler=ON
  character-set-server=UTF8MB3
  port        = 3306
  mysqlx_port = 33060
  bind-address=127.0.0.1
  #修改的socket文件的位置,默认是走的/tmp下的mysql.sock会有冲突
  socket      = /Users/yaoqiang/app/mysql-8.0.31/mysql.sock
  mysqlx_socket= /Users/yaoqiang/app/mysql-8.0.31/mysqlx.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
  init_connect='SET NAMES utf8'
  #修改mysql的主目录
  basedir=/Users/yaoqiang/app/mysql-8.0.31
  #添加data文件的目录,存储各种数据和日志
  datadir=/Users/yaoqiang/app/mysql-8.0.31/data
  
  log-bin=mysql-bin
  binlog_format=mixed
  server-id   = 1
  sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  # mysql是出于安全考虑,默认拒绝用root账号启动mysql服务,所以我们加下面一行
  # 指定mysql用户来启动mysql服务。
  user=mysql
  
[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=UTF8MB3

[myisamchk]
  key_buffer_size = 20M
  sort_buffer_size = 20M
  read_buffer = 2M
  write_buffer = 2M

[mysqlhotcopy]
  interactive-timeout
  1. 进入mysq 目录
cd /Users/yaoqiang/app/mysql-8.0.31/bin
  1. 执行 mysql 初始化
    若提示不安全则去设置里点击允许
./mysqld --defaults-file=/Users/yaoqiang/app/mysql-8.0.31/support-files/my.conf --initialize-insecure
  1. 启动mysql
./mysqld --defaults-file=/Users/yaoqiang/app/mysql-8.0.31/support-files/my.conf
# 如果出现[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld 则运行以下命令
sudo ./mysqld --defaults-file=/Users/yaoqiang/app/mysql-8.0.31/support-files/my.conf --user=root
  1. 进去mysql
./mysql -h 127.0.0.1 -uroot -p
  1. 创建用户(若使用随机生成密码,需要记住密码)
create user 'root'@'%' identified by 'root';

或者

create user 'holddie'@'%' IDENTIFIED BY RANDOM PASSWORD;
  1. 授权远程同步
grant replication slave on *.* to 'holddie'@'%';
  1. 保存刷新
flush privileges;

你可能感兴趣的:(macos,架构,mysql)