mysql_secure_installation

提示错误:
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解决方法:
#1.停止mysql数据库

/etc/init.d/mysqld stop

#2.执行如下命令

mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

#3.使用root登录mysql数据库

mysql -u root mysql

#4.更新root密码

mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';

#最新版MySQL请采用如下SQL:

mysql> UPDATE user SET authentication_string=PASSWORD('newpassword') where USER='root';

#5.刷新权限

mysql> FLUSH PRIVILEGES;

#6.退出mysql

mysql> quit

#7.重启mysql

/etc/init.d/mysqld restart

#8.使用root用户重新登录mysql

mysql -uroot -p

Enter password:
*************************************************************************************

最新文章

  1. 学习笔记:MySQL数据库初步 概念
  2. Bootstrap系列 -- 40. 导航条二级菜单
  3. MongoDB 3.0 用户创建
  4. 小波说雨燕 第三季 构建 swift UI 之 UI组件集-视图集(一)视图共性 学习笔记
  5. Websocket————错误总结
  6. [GeekBand] STL与泛型编程(3)
  7. CentOS5.5上安装git
  8. Git全解析之远程仓库交互
  9. sqlite数据库学习
  10. 使用Spring Cloud和Docker构建微服务架构
  11. flume 1.7 的配置
  12. ORA-01843: 无效的月份
  13. AWS中,如果使用了ELB,出现outofservice
  14. Spring Boot 正常启动后访问Controller提示404
  15. 枚举进行位运算 枚举组合z
  16. python多线程用法及与单线程耗时比较
  17. MySQL "replace into" 的坑以及insert相关操作
  18. Java程序设计11——GUI设计与事件处理B
  19. tomcat开发环境配置
  20. Java中关于Arrays.asList方法的深入学习与理解

热门文章

  1. 批量下载ts视频文件
  2. 【软件构造】第八章第三节 代码调优的设计模式和I/O
  3. VR技术在数据中心3D机房中的应用 (下)
  4. iOS之绘制像素到屏幕
  5. IOS学习笔记3—Objective C—简单的内存管理
  6. JavaScript设计模式基础之面向对象的JavaScript(二)
  7. 分页语句where条件中的子查询有or关键字优化
  8. mysql多字段组合删除重复行
  9. vue ui组件muse-ui的使用
  10. 使用github中py12306抢票系得