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
删除创建的用户和授权,
-
找到mysql配置文件并加入 (
/usr/local/etc/my.cnf)
-
default_authentication_plugin=mysql_native_password