mysql修改密码的三方法和忘记root密码的解决方法
时间:2024-01-24 18:45:12
方法1: 用SET PASSWORD命令
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
方法2:用mysqladmin
mysqladmin -u root password "newpass"
如果root已经设置过密码,采用如下方法
mysqladmin -u root password oldpass "newpass"
方法3: 用UPDATE直接编辑user表
mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
在丢失root密码的时候,可以这样
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;
标签:mysql,root,密码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python request要求接口参数必须是json数据的处理方式
2023-07-14 03:12:18
sqlserver中比较一个字符串中是否含含另一个字符串中的一个字符
2024-01-21 03:04:47
一些需要禁用的PHP危险函数(disable_functions)
2023-11-23 15:29:25
python+opencv边缘提取与各函数参数解析
2023-12-24 11:17:54
![](https://img.aspxhome.com/file/2023/7/124667_0s.png)
python代码实现将列表中重复元素之间的内容全部滤除
2023-11-17 18:17:32
![](https://img.aspxhome.com/file/2023/5/63585_0s.png)
HTTP协议详细介绍
2022-08-09 23:52:24
![](https://img.aspxhome.com/file/2023/2/112062_0s.png)
python中关于xmltodict的使用
2022-11-04 03:03:46
![](https://img.aspxhome.com/file/2023/0/105010_0s.png)
在.NetCore(C#)中使用ODP.NET Core+Dapper操作Oracle数据库
2024-01-26 05:33:06
Python 私有属性和私有方法应用场景分析
2023-12-06 05:36:42
flash与asp/php/asp.net通信的方法第1/3页
2023-11-15 03:43:03
基于Python共轭梯度法与最速下降法之间的对比
2022-10-27 06:58:12
![](https://img.aspxhome.com/file/2023/5/65885_0s.jpg)
Python+Opencv实战之人脸追踪详解
2022-09-22 16:03:38
![](https://img.aspxhome.com/file/2023/6/99136_0s.gif)
一篇文章带你了解kali局域网攻击
2022-02-21 23:53:35
![](https://img.aspxhome.com/file/2023/6/107996_0s.jpg)
js实现滑动进度条效果
2023-08-24 03:47:39
![](https://img.aspxhome.com/file/2023/7/56257_0s.gif)
PHP levenshtein()函数用法讲解
2023-06-01 15:20:29
![](https://img.aspxhome.com/file/2023/0/55380_0s.png)
Python转json时出现中文乱码的问题及解决
2021-11-29 17:02:16
MySql创建分区的方法实例
2024-01-23 22:17:40
![](https://img.aspxhome.com/file/2023/4/126274_0s.png)
SQL中日期与字符串互相转换操作实例
2024-01-27 15:41:56
python pandas dataframe 去重函数的具体使用
2023-10-15 00:56:36
CentOS中升级Python版本的方法详解
2021-08-22 20:22:30