今天搞node.js, 好不容易来连个数据库玩玩,结果尼玛死活连不上去,后来发现是主机的mysql没装,黑线了~~~
具体安装过程如下:
1. 安装MySQL;
2. 安装MySQL Workbench;
3. 打开后死活要密码,我还没设置捏~~
4. 苹果->系统偏好设置->最下边点mysql 在弹出页面中 关闭mysql服务
5: Start it in safe mode:
进入终端
输入:cd /usr/local/mysql/bin/
回车后 登录管理员权限 sudo su
回车后输入以下命令来禁止mysql验证功能
输入 ./mysqld_safe --skip-grant-tables &
Open another terminal and run the following command (Keep last terminal open)
mysql -u root
Run the following command with suitable new password on the mysql console
mysql > UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
尼玛直接报错!!!!说是没有password这货,WTF~~~~
google了一下, 原来从MySQL5.7之后,人家叫authentication_string了,晕死。
改成 UPDATE mysql.user SET authentication_string=PASSWORD('password') WHERE User='root'; 就ok了~~~
mysql > FLUSH PRIVILEGES;
Quit from both terminals and open new terminal and connect to mysql with root user and new password
mysql -uroot -p
6. enjoy!