1.安装
brew install mysql
2. 配置
mysql服务设置为开机自动启动
brew services start mysql
关闭mysql服务
brew services stop mysql
重启mysql服务
brew services restart mysql
查看mysql服务状态
brew services list
3. 设置root密码
mysql_secure_installation
设置步骤
a)为root用户设置密码
b)删除匿名账号
c)取消root用户远程登录
d)删除test库和对test库的访问权限
e)刷新授权表使修改生效
4. navicat连接
连接报错,执行如下命令
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
SELECT plugin FROM mysql.user WHERE User = 'root';
5. mysql导入数据报错
错误:ERROR 2006 (HY000): MySQL server has gone away
修改max_allowed_packet值
show variables like 'max_allowed_packet';
set global max_allowed_packet = 1048576000;
网友评论