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 ...
随机推荐
- Django-CRM项目学习(一)-admin组件
开始今日份整理 1.admin组件使用 1.1 创建django项目以及开启APP01 略 1.2 创建类 使用django自带的sqlite3的小型文件型的数据库 注:使用sqlite3类型的数据库 ...
- gulp 自动ftp至服务器时,处理开发 测试服务器地址问题
var gulp=require('gulp'), babel = require('gulp-babel'), gulpSequence = require('gulp-sequence'), ht ...
- Linux下安装 Python3
前言 Linux下大部分系统默认自带python2.x的版本,最常见的是python2.6或python2.7版本,默认的python被系统很多程序所依赖,比如centos下的yum就是python2 ...
- Spring Boot2.0使用Spring Security
一.Spring Secutity简介 Spring 是一个非常流行和成功的 Java 应用开发框架.Spring Security 基于 Spring 框架,提供了一套 Web 应用安全性 ...
- Git命令集
安装 Window https://gitforwindows.org/ MAC http://sourceforge.net/projects/git-osx-installer/ git conf ...
- IPv6绝不仅仅是对IPv4地址长度的增加
众所周知,IPv6 IP地址长度是IPv4 IP地址长度的四倍,是解决IPv4公共网址资源枯竭的最佳技术.的确,IETF在制定IPv6标准时也是基于这一因素考虑的.当时正是90年代初,Web开始出现, ...
- 菜鸟学习计划浅谈之Linux系统
人这一生都是在不断地学习,不断地进步中度过的,刚开始学习任何一门知识的时候,我们都习惯性的称自己为菜鸟,觉得自己对这方面的知识欠缺,水平很low,我也是如此.但我擅长总结,对于自己学习的新知识,总结学 ...
- js04-DOM对象一
一.什么是HTML DOM HTML Document Object Model(文档对象模型) HTML DOM 定义了访问和操作HTML文档的标准方法 HTML DOM 把 HTML 文档呈现 ...
- sql 书写 规范 优化
规范 做注解 便于修改和优化 规范 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE map ...
- MyBatis基础:MyBatis关联查询(4)
1. MyBatis关联查询简介 MyBatis中级联分为3中:association.collection及discriminator. ◊ association:一对一关联 ◊ collecti ...