mac 安装mysql 并开启bin-log

下载官网安装包mysql 5.7.28
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.28-macos10.14-x86_64.dmg

下载好后一路按照提示安装 默认就行

安装好后会弹出密码,把密码记录下来,后面登陆会用到

在这里插入图片描述
设置环境变量
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_%’;
在这里插入图片描述

发布了48 篇原创文章 · 获赞 5 · 访问量 1173

猜你喜欢

转载自blog.csdn.net/qq_34897849/article/details/103089569