当前位置:网站首页>mysql 修改密码和忘记密码操作
mysql 修改密码和忘记密码操作
2022-08-09 09:29:00 【潇湘梦】
忘记密码比较麻烦,太简单被攻破,太复杂记不住 嗨。。。。
重置密码的第一步就是跳过MySQL的密码认证过程,方法如下:
#vim /etc/my.cnf(注:windows下修改的是my.ini)
在文档内搜索mysqld定位到[mysqld]文本段:
/mysqld(在vim编辑状态下直接输入该命令可搜索文本内容)
在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程,如下图所示:
保存文档并退出
/etc/init.d/mysql restart (有些用户可能需要使用/etc/init.d/mysqld restart)
msyql
user mysql
update mysql.user set authentication_string=password('[email protected]') where user='root';
flush privileges; #立即生效
drop user [email protected]'%';
禁止、允许MySQL root用户远程访问权限
关闭MySQL root用户远程访问权限:
use mysql;
update user set host = "localhost" where user = "root" and host = "%";
flush privileges;
打开MySQL root用户的远程访问权限:
use mysql;
update user set host = "%" where user = "root";
flush privileges;
update user set host = '%' where user = 'cloudservice';
--创建名称为“testdb”数据库,并设定编码集为utf8
CREATE DATABASE IF NOT EXISTS testdb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
--创建了一个名为:test 密码为:1234 的用户
create user 'test'@'localhost' identified by '1234';
--授予用户test通过外网IP对数据库“testdb”的全部权限
grant all privileges on 'testdb'.* to 'test'@'%' identified by '1234';
CREATE DATABASE IF NOT EXISTS cloudservicedb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create user 'cloudservice'@'localhost' identified by '123456789';
grant all privileges on 'cloudservicedb'.* to 'cloudservice'@'%' identified by '123456789';
grant create,alter,drop,select,insert,update,delete on cloudservicedb.* to [email protected]'%';
SHOW DATABASES;
drop DATABASE please_read_me_vvv;
查看用户
select User,authentication_string,Host from user;
grant all privileges oncloudservicedb.* to 'cloudservice'@'%';
边栏推荐
猜你喜欢
常用功能测试的检查点与用例设计思路
全网最全的软件测试基础知识整理(新手入门必学)
软件测试分析流程及输出项包括哪些内容?
接口测试主要测试哪方面?需要哪些技能?要怎么学习?
What does the test plan include?What is the purpose and meaning?
A Practical Guide to Building OWL Ontologies using Protege4 and CO-ODE Tools - Version 1.3 (7.4 Annotation Properties - Annotation Properties)
web测试之功能测试常用的方法有哪几种?有什么要点要注意?
性能测试包括哪些方面?分类及测试方法有哪些?
lateral view explode的另一种实现方式
测试用例的原则、缺陷报告怎么写你都知道吗?
随机推荐
JS报错-Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on...
软件测试面试中,面试官问你一些比较“刁难”的问题你会怎么回答
功能自动化测试实施的原则以及方法有哪些?
条件和递归
网络安全入门基础:IP地址
Domestic with Google earth software, see the download 19th level high-resolution satellite images so easy!
Go-指针的那些事
Lecture 4 SVN
【机器学习】数据科学基础——机器学习基础实践(二)
白盒测试的概念、目的是什么?及主要方法有哪些?
5.Set接口与实现类
LPP code and its comments
unittest测试框架原理及测试流程解析,看完绝对有提升
.equals ==
6.File类
Tigase插件编写——注册用户批量查询
本体开发日记05-努力理解SWRL(上)
Onnx - environment build 】 【 tensorrt
Cisco common basic configuration of common commands
Ontology Development Diary 03-Understanding Code