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 ...
随机推荐
- springMVC使用HandlerMethodArgumentResolver 自定义解析器实现请求参数绑定方法参数
http://blog.csdn.net/truong/article/details/30971317 http://blog.csdn.net/fytain/article/details/439 ...
- HBase源码实战:ImportTsv
/** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agr ...
- python3 Counter模块
from collections import Counter c = Counter("周周周周都方法及")print(c)print(type(c))print('__iter ...
- 即将发布的 ASP.NET Core 2.2 会有哪些新玩意儿?
今年 6 月份的时候时候 .NET 团队就在 GitHub 公布了 ASP.NET Core 2.2 版本的 Roadmap(文末有链接),而前两天 ASP.NET Core 2.2 预览版 2 已经 ...
- docker 小技巧 列出所有容器的IP地址
命令如下: [root@localhost ~]# docker inspect --format='{{.Name}} - {{range .NetworkSettings.Networks}}{{ ...
- Scrapy命令行详解
官方文档:https://doc.scrapy.org/en/latest/ Global commands: startproject genspider settings runspider sh ...
- rs485引脚定义
转自:http://blog.chinaunix.net/uid-9688646-id-3275796.html rs485有两种,一种是半双工模式,只有DATA+和DATA-两线,另一种是全双工模式 ...
- 常用vim命令
一.Vim编辑器的常用命令 在Linux下毫无疑问vim编辑器是非常好用的 因为平时有用到,有些东西不常用就会忘记,特记录下自己一些常用的 1.1.2 命令模式转换为编辑模式 i: 在当前光标所在 ...
- MySQL CONCAT opposite
csv - What is the opposite of GROUP_CONCAT in MySQL? - Stack Overflowhttps://stackoverflow.com/quest ...
- php_network_getaddresses: getaddrinfo failed 原因
一般在调用外部服务请求时候,有时由于配置问题无法访问,phph会报一个php_network_getaddresses: getaddrinfo failed: Name or servicenot ...