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/
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
设置命令行PATH
export PATH=${PATH}:/opt/homebrew/Cellar/mysql/8.1.0/bin/
mysql的启动:
mysql.server start mysql.server stop mysql.server restart
设置密码
update user set authentication_string='' where user='root'; set password='1234';