MySQL修改密码和忘记ROOT密码
1、关闭数据库
脚本:[root@mysql etc]# service mysql stop
2、使用脚本: mysqld_safe --skip-grant-tables 启动数据库
使用/usr/bin/mysqld_safe --skip-grant-tables&启动数据库
3、使用空密码进入数据库(mysql命令后直接回车)
[root@mysql ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
4、使用UPDATE语句修改ROOT密码
mysql> UPDATE mysql.user SET
-> PASSWORD=PASSWORD('root')
-> where
-> User='root' AND Host='localhost';
5、关闭数据库并重新以正常方式启动数据库
[root@mysql ~]# service mysql restart;
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
[root@mysql ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@mysql ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.20-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
MySQL修改密码和忘记ROOT密码的更多相关文章
- mysql 免安装与 忘记root密码 密码过期
免安装: 参考 :https://blog.csdn.net/werwqerwerwer/article/details/52919939 注:别忘了配置环境变量 忘记root密码解决办法: 1. ...
- ubuntu 忘记密码,忘记root密码的解决办法
ubuntu的root默认是禁止使用的,在安装的时候也没有要求设置root的密码.要使用,给root设置密码就行了,sudo passwd root .如果只是普通用户密码忘了,用root就可以修改. ...
- mysql 5.7.16 忘记root 密码 如何修改root密码
今天在电脑上安装 mysql5.7.16 (压缩包)时,在初始化data文件夹之后,没有记住密码,DOS框没有显示,没办法,为了学习一下怎么修改密码,在网上找了好多方法去解决,最终还是解决了,下面来 ...
- mysql 5.7.26 忘记root密码
1.关闭mysql [root@mysql ~]# /etc/init.d/mysqld stopShutting down MySQL.. SUCCESS! 2.修改参数文件/etc/my.cnf ...
- ubuntu忘记密码,忘记root密码的解决方法
转载于http://forum.ubuntu.org.cn/viewtopic.php?t=272164 ubuntu的root默认是禁止使用的,在安装的时候也没要求你设置root的密码,和红帽系统系 ...
- MySQL 5.7忘记root密码如何修改?
一直以来,MySQL的应用和学习环境都是MySQL 5.6和之前的版本,也没有去关注新版本MySQL 5.7的变化和新特性.今天帮人处理忘记root密码的时时候,发现以前的方法不奏效了.具体情况如下所 ...
- skip-grant-tables 修改linux的mysql忘记root密码
skip-grant-tables 修改linux的mysql忘记root密码 今天修改mysql中的admin用户权限,在执行update user set host =' %' where use ...
- yum 安装 Mysql error ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 开启远程连接 修改登入密码 忘记root密码 配置防火墙规则 随手mark
yum 安装 MYsql: yum install mysql mysql-server mysql-devel -y 1.1 登入报错: ERROR 1045 (28000): Acc ...
- MYSQL忘记root密码后如何修改
方法1: 用SET PASSWORD命令 首先登录MySQL. 格式:mysql> set password for 用户名@localhost = password('新密码'); 例子:my ...
随机推荐
- sed——linux下对文本当控制操作(替换,追加)
sed——linux下对文本当控制操作(替换,追加) 2011-12-12 19:27:17 分类: LINUX Linux下sed命令 1. Sed简介 sed 是一种在线编辑器,它一次处理一行内容 ...
- ExecutorService中submit和execute的区别<转>
在Java5之后,并发线程这块发生了根本的变化,最重要的莫过于新的启动.调度.管理线程的一大堆API了.在Java5以后,通过Executor来启动线程比用Thread的start()更好.在新特征中 ...
- Android——listview android:cacheColorHint,android:listSelector属性作用
ListView是常用的显示控件,默认背景是和系统窗口一样的透明色,如果给ListView加上背景图片,或者背景颜色时,滚动时listView会黑掉, 原因是,滚动时,列表里面的view重绘时,用的依 ...
- freemarker XMLGregorianCalendar 转日期
${m.createdate.toGregorianCalendar().getTime()?string("yyyy-MM-dd")} createdate为XMLGregori ...
- thymeleaf传值onclick到js
带有单引号 targetUrl('val') <a th:onclick="'javascript:targetUrl(\''+${indexURL.value}+'\');'&quo ...
- Publishing to IIS 发布到IIS
原文:https://docs.asp.net/en/latest/publishing/iis.html 发布到IIS Publishing to IIS By Rick Anderson and ...
- <转> linux进程状态的说明
我只是做一个mark,为了日后复习:http://blog.csdn.net/tianlesoftware/article/details/6457487 他写得非常的详细,值得推荐. 补充一点什么是 ...
- fresco中设置占位/加载失败的图片 无效
在xml中设置 placeholderImage 属性无效.代码如下: <com.facebook.drawee.view.SimpleDraweeView android:id=" ...
- .net操作oracle,一定要用管理员身份运行 visual studio 啊,切记切记,免得报奇怪的错误。
.net操作oracle,一定要用管理员身份运行 visual studio 啊,切记切记,免得报奇怪的错误.
- OAuth 授权