Macbook 安装Mysql 8.0 的步骤

brew mysql install

Mysql文件路径 /opt/homebrew/Cellar/mysql/8.1.0/

查看相应的权限 ls -laF /opt/homebrew/Cellar/mysql/
给文件夹赋予相应的权限 sudo chown -R sean /opt/homebrew/Cellar/mysql/
  • 1.
  • 2.

cnf文件地址

/opt/homebrew/etc/my.cnf

文件内容

# Default Homebrew MySQL server config
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
pid-file=/var/run/mysqld/mysqld.pid
lower_case_table_names  = 2
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# Only allow connections from localhost

[client]
default-character-set=utf8mb4
 
[mysql]
default-character-set=utf8mb4
 
bind-address = 127.0.0.1
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.

设置命令行PATH

export PATH=${PATH}:/opt/homebrew/Cellar/mysql/8.1.0/bin/
  • 1.

mysql的启动:

mysql.server start
mysql.server stop
mysql.server restart
  • 1.
  • 2.
  • 3.

设置密码

update user set authentication_string='' where user='root';
set password='1234';
  • 1.
  • 2.
posted @ 2023-10-16 21:48  Appinn  阅读(191)  评论(0编辑  收藏  举报  来源