错误案例
Access denied for user 'root'@'localhost' (using password: YES)
安装mysql 步骤
- 关闭mysql服务器 sudo /usr/local/mysql/support-files/mysql.server stop
- 进入目录 cd /usr/local/mysql/bin
- 获取权限 sudo su
- 重启服务器 ./mysqld_safe --skip-grant-tables &
- control + D退出编辑
- 配置短命令 alias mysql=/usr/local/mysql/bin/mysql
- 进入mysql命令模式 mysql
- 进入mysql数据库 use mysql
- 获取更改权限 flush privileges
- 重置密码 update user set password=PASSWORD("123456")where user = "root"
参考案例
http://www.jianshu.com/p/75792bb16ee7
http://www.jianshu.com/p/251b3a60c50c