MAC 系统环境配置记录

 

安装mysql

 

brew install mysql

 

 

We've installed your MySQL database without a root password. To secure it run:

    mysql_secure_installation

 

MySQL is configured to only allow connections from localhost by default

 

To connect run:

    mysql -uroot

 

To have launchd start mysql now and restart at login:

  brew services start mysql

Or, if you don't want/need a background service you can just run:

  mysql.server start

 

 

开启安全模式

mysqld_safe --skip-grant-tables

 

可以无密码登陆mysql

mysql -uroot -p

 

更改mysql 密码

 

 

 

添加新用户 (mysql 命令行下执行)

CREATE USER `admin`@`127.0.0.1` IDENTIFIED BY 'admin123';
 
GRANT `root`@`localhost` TO `admin`@`127.0.0.1`;
 
SET DEFAULT ROLE `root`@`localhost` TO `admin`@`127.0.0.1`;
 
GRANT `admin`@`127.0.0.1` TO `root`@`localhost`;

 

 

 

"

mysql 安装了最新版本8.x版本后的报错: the server requested authentication method unknown to the client"

https://blog.csdn.net/youcijibi/article/details/81153789

删除创建的用户和授权,

    1. 找到mysql配置文件并加入 (/usr/local/etc/my.cnf)

  1. default_authentication_plugin=mysql_native_password

 

posted on 2019-09-29 14:50  bandbandme  阅读(177)  评论(0编辑  收藏  举报