GVKun编程网logo

问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables 跳过权限认证参数启动报错处理

8

如果您对问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables跳过权限认证参数启动报错处理感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于问

如果您对问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables 跳过权限认证参数启动报错处理感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables 跳过权限认证参数启动报错处理的详细内容,并且为您提供关于CentOS服务器mysql忘记root密码恢复、linux下,mysql忘记root密码解决方法--mysql修改root密码、Linux服务器---mysql忘记root密码、Mac-Mysql忘记root密码的有价值信息。

本文目录一览:

问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables 跳过权限认证参数启动报错处理

问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables 跳过权限认证参数启动报错处理

问题描述:

误操作将root密码重置后root原先密码登录不上,加skip-grant-tables 参数数据库启动失败,排查错误日志如下:

由于MysqL节点用到了半同步复制,尝试把半同步参数去掉试试,启动成功

  skip-grant-tables 参数与半同步插件冲突,官方解释是在使用skip-grant-tables参数后,MysqL启动的时候会跳过所有的系统权限表,使得所有用户都可以不需要身份认证登录数据库,然后可以执行flush privileges来重新加载权限表,然而该参数会导致通过install plugin语句加载的插件以及调度事件等无法加载到MysqL;

  如果有需求需要同时都加载,可以使用启动命令中--plugin-load,或者my.cnf中添加:

plugin-load="rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"

CentOS服务器mysql忘记root密码恢复

CentOS服务器mysql忘记root密码恢复

MysqL的root忘记,现无法操作数据库停止MysqL服务serviceMysqLstop或者是ps-ef|grepMysqL|xargskill-9然后使用如下的参数启动MysqL,--skip-grant-tables会跳过MysqL的授权shell#/usr/bin/MysqLd_safe--skip-grant-tables&MysqL-p回车,进入不需要密码MysqL>MysqL>updateMysqL.usersetPassword=password('itnihao')whereUser='root';QueryOK,4rowsaffected(0.00sec)
Rowsmatched:4Changed:4Warnings:0
MysqL>flushprivileges;
QueryOK,0rowsaffected(0.00sec)重启MysqL,serviceMysqLstop或者是ps-ef|grepMysqL|xargskill-9MysqL-p然后输入密码,至此,MysqL密码已经修改完毕

linux下,mysql忘记root密码解决方法--mysql修改root密码

linux下,mysql忘记root密码解决方法--mysql修改root密码

linux管理员可能出现忘记mysql root密码的情况,可以进行如下的步骤重新设置MySQL的root密码: 

1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接MySQL数据库。 
因为在重新设置MySQL的root密码的期间,MySQL数据库完全出于没有密码保护的 
状态下,其他的用户也可以任意地登录和修改MySQL的信息。可以采用将MySQL对 
外的端口封闭,并且停止Apache以及所有的用户进程的方法实现服务器的准安全 
状态。最安全的状态是到服务器的Console上面操作,并且拔掉网线。 

2.修改MySQL的登录设置: 
# vi /etc/my.cnf 
在[mysqld]的段中加上一句:skip-grant-tables 
例如: 
[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
skip-grant-tables 
保存并且退出vi。 

3.重新启动mysqld 
# /etc/init.d/mysqld restart 
Stopping MySQL: [ OK ] 
Starting MySQL: [ OK ] 

4.登录并修改MySQL的root密码 
# /usr/bin/mysql 
Welcome to the MySQL monitor. Commands end with ; or g. 
Your MySQL connection id is 3 to server version: 3.23.56 

Type ''help;'' or ''h'' for help. Type ''c'' to clear the buffer. 

mysql> USE mysql ; 
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 ( ''new-password'' ) WHERE User = ''root'' ; 
Query OK, 0 rows affected (0.00 sec) 
Rows matched: 2 Changed: 0 Warnings: 0 

mysql> flush privileges ; 
Query OK, 0 rows affected (0.01 sec) 

mysql> quit 
Bye 

5.将MySQL的登录设置修改回来 
# vi /etc/my.cnf 
将刚才在[mysqld]的段中加上的skip-grant-tables删除 
保存并且退出vi。 

6.重新启动mysqld 
# /etc/init.d/mysqld restart 
Stopping MySQL: [ OK ] 
Starting MySQL: [ OK ] 

7.恢复服务器的正常工作状态 
将步骤一中的操作逆向操作。恢复服务器的工作状态。

Linux服务器---mysql忘记root密码

Linux服务器---mysql忘记root密码

忘记root密码

如果不小心忘记了root密码,那么mysql就不能再登录了,这时就要重置root密码才行。通过下面的步骤,我们可以重新设置root密码。

1、退出mysql

[root@localhost src]# service mysqld stop

停止mysqld                                             [确定]

[root@localhost src]# 

 

2、进入sql安全模式,命令“/usr/bin/mysqld_safe --skip-grant-table &

[root@localhost src]#/usr/bin/mysqld_safe --skip-grant-table &

[1] 6332

[root@localhost src]# 180814 10:10:00 mysqld_safe Logging to ''/var/log/mysqld.log''.

180814 10:10:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

 

3、无密码方式登录,命令“mysql –u root”

[root@localhost src]# mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.71 Source distribution

Copyright (c) 2000, 2013, 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、使用mysql,命令“use mysql;” 

mysql> use mysql;

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> 

 

5、重设root密码,命令“update user set password=password (“密码”) where user=’root’”

mysql> update user set password=password(''123456'') where user=''root'';

Query OK, 3 rows affected (0.00 sec)

Rows matched: 3  Changed: 3  Warnings: 0

mysql> 

 

6、刷新 

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

7、退出,重新登录

[root@localhost src]# mysql -u root -p

Enter password:        //这里输入新密码

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Sever version: 5.1.71 Source distribution

Copyright (c) 2000, 2013, 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> 

 

 

做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密码:n7bk

Mac-Mysql忘记root密码

Mac-Mysql忘记root密码

 

cd /usr/local/mysql/bin
切换到root权限 ,需要输入密码:
sudo su
输入之后会看见如下信息:
sh-3.2#
使用如下命令以安全模式运行mysql
./mysqld_safe --skip-grant-tables &
现在从开一个终端:输入:
mysql -uroot
就可以进入mysql
修改root密码,执行下面的命令。
mysql> FLUSH PRIVILEGES;
继续执行一下名利修改密码:
mysql> SET PASSWORD FOR root@''localhost'' = PASSWORD(''new password'');
到此为止。


cd /usr/local/mysql/bin
切换到root权限 ,需要输入密码:
sudo su
输入之后会看见如下信息:
sh-3.2#
使用如下命令以安全模式运行mysql
./mysqld_safe --skip-grant-tables &
现在从开一个终端:输入:
mysql -uroot 就可以进入mysql 修改root密码,执行下面的命令。 mysql> FLUSH PRIVILEGES; 继续执行一下名利修改密码: mysql> SET PASSWORD FOR root@''localhost'' = PASSWORD(''new password''); 到此为止。
 

 

今天的关于问题记录——测试环境mysql服务忘记root密码后加skip-grant-tables 跳过权限认证参数启动报错处理的分享已经结束,谢谢您的关注,如果想了解更多关于CentOS服务器mysql忘记root密码恢复、linux下,mysql忘记root密码解决方法--mysql修改root密码、Linux服务器---mysql忘记root密码、Mac-Mysql忘记root密码的相关知识,请在本站进行查询。

本文标签: