不停止MySQL服务的情况下修改root的密码
二、不重启mysqld的方法
1、首先得有一个可以拥有修改权限的mysql数据库账号,当前的mysql实例账号(较低权限的账号,比如可以修改test数据库)或者其他相同版本实例的账号。把data/mysql目录下面的user表相关的文件复制到data/test目录下面。
[root@localhost mysql]# cp mysql/user.* cacti/
[root@localhost mysql]# chown mysql.mysql cacti/user.*
2、使用另一个较低权限的账号链接数据库,设置test数据库中的user存储的密码数据。
[root@localhost mysql]# mysql -ucacti -pcacti
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.5.25a-log Source distribution
Copyright (c) 2000, 2011, 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> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password('kongzhong123') where user='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 5 Changed: 0 Warnings: 0
mysql>
3、把修改后的user.MYD和user.MYI复制到mysql目录下,记得备份之前的文件。
mv mysql/user.MYD mysql/user.MYD.bak
mv mysql/user.MYI mysql/user.MYI.bak
cp test/user.MY* mysql/
chown mysql.mysql mysql/user.*
4、查找mysql进程号,并且发送SIGHUP信号,重新加载权限表。
[root@localhost mysql]# pgrep -n mysql
2184
[root@localhost mysql]#
[root@localhost mysql]# kill -SIGHUP 2184
5、登陆测试
[root@localhost mysql]# mysql -uroot -pkongzhong123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 5.5.25a-log Source distribution
Copyright (c) 2000, 2011, 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的密码的更多相关文章
- kafka不停止服务的情况下修改日志保留时间
kafka配置文件如下: broker.id=1 port=9092 host.name=ssy-kafka1 num.network.threads=4 num.io.threads=8 socke ...
- (转)不停止Nginx服务的情况下平滑变更Nginx配置
在不停止Nginx服务的情况下平滑变更Nginx配置 1.修改/usr/local/webserver/nginx/conf/nginx.conf配置文件后,请执行以下命令检查配置文件是否正确: /u ...
- Ubuntu-18.04 下修改root用户密码,安装SSH服务,允许root用户远程登录,安装vsftp服务器
修改root用户密码 打开终端,输入 sudo passwd root 指令: 安装SSH服务 ssh默认端口号是22,可以在/etc/ssh/sshd_config文件中修改 查看服务器否开启:ne ...
- CentOS6.5_x64安装MySQL-5.6.17,在已经启动MySQL服务的情况下,出现密码报错ERROR 2002 (HY000)
1.修改MySQL配置文件,使MySQL登陆时跳过密码验证 skip-grant-tables 2.重启MySQL服务 service mysql restart 3.进入MySQL,修改user表中 ...
- 可遇不可求的Question之Mysql在不重启服务的情况下修改运行时变量篇
比方说在一些实际生产环境中,想改个MYSQL的配置,但是又不想停止服务重起MYSQL,有什么办法呢?使用SET命令可以做到,请看下面几个例子: 1.设置key_buffer_size的大小为10M. ...
- Ubuntu 在未知root密码的情况下修改root密码
一, 开机按 F12 (或长按Shift), 进入GRUB界面. 二, 在 recovery mode 按e Ubuntu, Linux 3.5.0-17-generic (恢复模式) (或recov ...
- mac 安装mysql + 修改root用户密码 + 及报Access denied for user 'root'@'localhost' (using password:YES)解决办法
1.下载MySQL 到mysql的官网http://dev.mysql.com/downloads/mysql/然后在页面中会看到“MySQL Community Server”下方有一个“downl ...
- MySQL修改root账号密码
MySQL数据库中如何修改root用户的密码呢?下面总结了修改root用户密码的一些方法 1: 使用set password语句修改 mysql> select user(); +----- ...
- Mac下启动和停止Mysql服务
方法1. 启动Mysql服务 sudo /Library/StartupItems/MySQLCOM/MySQLCOM start 停止Mysql服务 sudo /Library/Star ...
随机推荐
- 突然发现这周有点忙。。着玩-PHP进阶
hi 周二才,不过我突然意识到这周有点忙着玩的感觉,还是很期待的——今天下午去市里,晚上回来看电影,明晚聚餐吃火锅,后天下午拍短片,晚上可能要打球,周五,嗯,就到周五了.虽然这样下去连怎么写(bian ...
- 基于Bootstrap的DropDownList的JQuery组件的完善版
在前文 创建基于Bootstrap的下拉菜单的DropDownList的JQuery插件 中,实现了DropDownList的JQuery组件,但是留有遗憾.就是当下拉菜单出现滚动条的时候,滚动条会覆 ...
- [Top-Down Approach] Assignment 1: WebServer [Python]
Today I complete Socket Programming Assignment 1 Web Server Here is the code: #!/usr/bin/python2.7 # ...
- UART Explained(转载)
做嵌入式开发,UART几乎是必不可少的,调试串口.GPS.GPRS.Bluetooth等模块很多都是用的UART接口.时下火热的IoT也不乏UART的身影,串口的BLE.WIFI.Zigbee.Lor ...
- [No00003A]操作系统Operating Systems 内核级线程Kernel Threads内核级线程实现Create KernelThreads
开始核心级线程 内核级线程对多核的支持怎么样? 和用户级相比,核心级线程有什么不同? ThreadCreate 是系统调用,内核管理TCB ,内核负责切换线程 如何让切换成型? − − 内核栈,TCB ...
- vijos1907[noip2014]飞扬的小鸟(完全背包)
描述 Flappy Bird 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小鸟一不小心撞到了水管或者掉在地上的话,便宣告 ...
- python-day02数据类型-字符串和列表的操作
while循环: while True: 条件语句....... 关于break和continue,break:跳出当前的循环 contnu ...
- webclient 比浏览器加载页面慢的一个问题
测试中发现webclient 比浏览器加载页面慢的一个问题:原因WebClient 支持 gzip, deflate,但是未设置 解决方案: class WebClientEx : WebClient ...
- C#输出log信息
在写程序的过程中,有时候我们需要添加一些log信息,这个时候,可以采用下面的方法来实现. public static void WriteLog(string ExtraMsg, Exception ...
- CodeGenerator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CiCe ...