mysql root password
"""
centos:
mysql忘记root密码解决
1.修改MySQL的登录设置:
# vim /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
例如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables
2.重启mysql
systemctl restart mysqld.service
3.登录mysql
mysql
4.修改root用户密码:
先将密码设置为空
update user set authentication_string='' where user='root'
再修改密码
ALTER user 'root'@'localhost' IDENTIFIED BY 'Cliu123#'
如果遇到The MySQL server is running with the --skip-grant-tables option
so it cannot execute this statement 则刷新权限即可(FLUSH PRIVILEGES)
注意: 一定不要采取如下形式该密码:
use mysql;
update user set authentication_string="newpassword" where user="root";
这样会给user表中root用户的authentication_string字段下设置了newpassword值;
当再使用ALTER USER 'root'@'localhost' IDENTIFITED BY 'newpassword'时会报错的;
因为authentication_string字段下只能是mysql加密后的41位字符串密码;其他的会报格式错误;
5.编辑my.cnf文件删掉skip-grant-tables 这一行
6.重启mysql
为用户授权并用于远程连接
GRANT ALL PRIVILEGES ON *.* TO 'tny'@'localhost' IDENTIFIED BY 'Test123456!' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'tny'@'10.18.192.52' IDENTIFIED BY 'Test123456!' WITH GRANT OPTION;
mysql8.0给用户授权时需要先创建用户:
create user 'zac'@'%' identified by 'Za888888!';
GRANT EXECUTE,INSERT,SELECT,UPDATE ON *.* TO 'tny'@'%';
grant on tpservice22.* to 'tny'@'%' ;
客户端使用密码验证,进行登录
ALTER USER 'tny'@'%' IDENTIFIED WITH mysql_native_password BY 'Za888888!';
FLUSH PRIVILEGES;
将用户加入组
usermod -a -G mysql root
grant all privileges on *.* to 'root'@'10.18.192.52' identified by "Test123456!" ;
"""
mysql root password的更多相关文章
- Linux - Reset a MySQL root password
Use the following steps to reset a MySQL root password by using the command line interface. Stop the ...
- mysql forget root password
http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password MySQL - ...
- windows下新安装的mysql修改root password问题
常用步骤: 1. 在my.ini中的mysqld下添加一行 skip-grant-tables 2.重启mysql后直接进入后,用SQL直接修改password列: C:\> net stop ...
- MYSQL更改root password时遇到Access Denied的解决办法
今天在公司虚拟机上装MYSQL之后需要修改root password,然而遇到这样的错误: Access denied for user 'root'@'localhost' (using passw ...
- MYSQL安装时解决要输入current root password的解决方法
在装MYSQL的时候发现要输入current root password不记得以前在电脑里装过(你的系统曾经装过MYSQL在重装就会要求输入原来设定的密码,如果是第一次安装就不会出现),在网上苦苦搜寻 ...
- Mysql安装配置以及解决重装Mysql时忘记root password问题
目录 1.Mysql安装以及环境变量配置 重装Mysql时忘记root password问题 1.Mysql安装以及环境变量配置 官网安装:https://www.mysql.com/ 按 ...
- MySQL root密码找回
以MySQL多实例为例,演示找回MySQL root的密码 1.关闭mysql服务 [root@mysql ~]# mysqladmin -uroot -poldboy123 -S /data/330 ...
- mysql root 维护
修改root密码: mysql -uroot -paaamysql> use mysql;mysql> UPDATE user SET password=password("aa ...
- MySQL root密码重置 报错:mysqladmin: connect to server at 'localhost' failed的解决方案
===========================================================二,忘记本地root的登录密码解决过程:1.编辑/mysql/my.ini在[my ...
随机推荐
- How Cigna Tuned Its Spark Streaming App for Real-time Processing with Apache Kafka
Explore the configuration changes that Cigna’s Big Data Analytics team has made to optimize the perf ...
- B. Creating the Contest(水题)
直接水过 #include<iostream> #include<algorithm> using namespace std; ; int a[maxn]; int n, u ...
- CentOS下部署Redis集群
一.部署环境 服务器三台: 10.10.15.41(配置运行两个实例,端口:6379,6380) 10.10.15.42(配置运行两个实例,端口:6381,6382) 10.10.15.43(配置运行 ...
- python3 pickle模块
import pickle '''将对象转化为硬盘能识别的bytes的过程被称为序列号将bytes转化为对象的过程被称为反序列化'''lst = ["苹果", "橘子&q ...
- 基础数据类型:整型int、布尔值bool、字符串str、与for循环
1.整型 int() p2 long 长整型 p3 全部都是整型 2.布尔值 bool() True --- int() int(True) int() --- True bool(int) 注意点: ...
- 使用jprofiler分析dump文件一个实例
3 .dump 线上文件栈 [root@yszyz10a153 ~]# jmap -dump:live,format=b,file=heap201712.hropf 72947 参考:https:/ ...
- 阿里面试题BIO和NIO数量问题附答案和代码
一.问题 BIO 和 NIO 作为 Server 端,当建立了 10 个连接时,分别产生多少个线程? 答案: 因为传统的 IO 也就是 BIO 是同步线程堵塞的,所以每个连接都要分配一个专用线程来处理 ...
- 循环语句之for循环
什么是循环语句? 循环语句可以在满足循环条件的情况下,反复执行某一段代码,这段被重复执行的代码被称为循环体语句,当反复执行这个循环体时,需要在合适的时候把循环判断条件修改为false,从而结束循环,否 ...
- websocket作用及意义
Browser已经支持http协议,为什么还要开发一种新的WebSocket协议呢?我们知道http协议是一种单向的网络协议,在建立连接后,它只允许Browser/UA(UserAgent)向WebS ...
- Day3 Numerical simulation of optical wave propagation之标量衍射理论基本原理(三)
3.标量衍射理论 光源通常不是简单地平面.球面或高斯光束波.对于更一般的情况,必须使用更老练的方法来求解标量赫姆霍兹方程,需要利用格林定理并灵活使用边界条件. 基本问题:给定源平面光场U(x1,y1) ...