If you have forgot the MySQL root password, can’t remember or want to break in….. you can reset themysql database password from the command line in either Linux or macOS Sierra and OSX as long as you know the root user password of the box you are on, this is for MySQL 5.7 onwards:

Stop MySQL

sudo /usr/local/mysql/support-files/mysql.server stop

Start it in safe mode:

sudo mysqld_safe --skip-grant-tables

This will be an ongoing command until the process is finished so open another shell/terminal window, and log in without a password as root:

mysql -u root
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

Change the lowercase ‘MyNewPass’ to what you want – and keep the single quotes.

\q

Start MySQL

sudo /usr/local/mysql/support-files/mysql.server start

Thats it, now your root password will be updated.

Share this:

原文地址:https://coolestguidesontheplanet.com/how-to-change-the-mysql-root-password/

最新文章

  1. 点击ViewGroup时其子控件也变成pressed状态的原因分析及解决办法
  2. Mysql的视图、存储过程、函数、索引全解析
  3. VB6 GDI+ 入门教程[7] Graphics 其他内容
  4. 黄聪:如何删除wordpress登录之后wp_footer、wp_head自行加载的Open Sans字体、fonts.googleapis.com连接导致卡死的问题
  5. IDEA使用docker进行调试
  6. cocos2d-x 详解之 CCAction(动作)
  7. Jsp(3):内置对象和四种域对象的理解
  8. JS年月日三级联动下拉框日期选择代码
  9. 如何隐藏DLL中,导出函数的名称?
  10. Javascript内存泄漏
  11. js架构设计模式——从angularJS看MVVM
  12. 神经网络与深度学习笔记 Chapter 2.
  13. Python 数据分析Windows环境搭建
  14. 【Python实践-6】将不规范的英文名字,变为首字母大写,其他小写的规范名字
  15. 【C语言编程练习】5.12 兔子产仔问题
  16. Linux系统管理常用命令用法总结(2)
  17. mybatis知识点(已掌握)
  18. css 文本和div垂直居中方法汇总
  19. MySQL存储过程中的3种循环【转载】
  20. disconf-client-for-java

热门文章

  1. 不固定高宽的 div 水平垂直居中
  2. 【Educational Codeforces Round 36 D】 Almost Acyclic Graph
  3. 关于使用strtok的一个小问题
  4. node.js是什么
  5. NPOI根据列索引获取列名
  6. 基于Linux系统WINE虚拟机技术的研究
  7. ubuntu搭建交叉编译环境makeinfo: command not found
  8. 常用处理字符串的SQL函数
  9. http的原理
  10. LayoutAnimation-容器动画