下载官网安装包mysql 5.7.28
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.28-macos10.14-x86_64.dmg
链接:https://pan.baidu.com/s/1dKaPHgC2cJIgD9p2jtDRkg
提取码:pyh9
下载好后一路按照提示安装 默认就行
安装好后会弹出密码,把密码记录下来,后面登陆会用到
设置环境变量
cd ~
vim ./.bash_profile
export PATH=$PATH:/usr/local/mysql/bin
启动mysql
sudo mysql.server start
修改密码
mysql -u root -p’你刚才的密码’
alter user root@localhost identified by 'root';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' ;
flush privileges;
exit;
开启bin-log
vim /etc/my.cnf
插入
[mysqld]
default-storage-engine=INNODB
character-set-server=utf8
log-bin = mysql-bin
binlog-format = ROW
server_id = 1
port = 3306
[client]
default-character-set=utf8
重启mysql
mysql -uroot -proot
show variables like ‘%char%’;
show variables like ‘log_%’;