# 检查 MySQL 运行状态 sudo support-files/mysql.server status
登录
1 2
cd /Users/atomic/.app/mysql/bin ./mysql -u root -p
(初始化时候随机生成的密码)
修改密码
1 2 3 4 5 6 7 8 9
# mac 下修改密码 SET PASSWORD = PASSWORD('your new password'); # linux 下修改密码 alter user 'root'@'localhost' identified by '123456';
# 设置密码有效期为永久 ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; # 刷新权限 flush privileges;
打开远程访问
1 2 3 4 5 6 7 8 9 10 11 12 13 14
mysql> select host from user where user = 'root'; +-----------+ | host | +-----------+ | localhost | +-----------+ mysql> update user set host = '%' where user='root'; mysql> flush privileges; mysql> select host from user where user='root'; +------+ | host | +------+ | % | +------+