如何重置mysql的密码
- 如何重置mysql的密码
- 如果知道密码,则通过以下方式修改;
- gaurav@gaurav:~$ mysql --user=root --pass mysql
- Enter password:
- mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';
- Query OK, 2 rows affected (0.04 sec)
- Rows matched: 2 Changed: 2 Warnings: 0
- mysql> flush privileges;
- Query OK, 0 rows affected (0.02 sec)
- mysql> exit
- Bye
- 如果忘记密码,则先停止mysql,然后加上参数skip-grant-tables重新启动mysql server
- root@gaurav:~# /etc/init.d/mysql stop
- Now you should start up the database in the background, via the mysqld_safe command:
- root@gaurav:~# /usr/bin/mysqld_safe --skip-grant-tables &
- [1] 4271
- Starting mysqld daemon with databases from /var/lib/mysql
- mysqld_safe[6763]: started
- 然后登陆mysql,修改密码
- root@gaurav:~$ mysql --user=root mysql
- Enter password:
- mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';
- Query OK, 2 rows affected (0.04 sec)
- Rows matched: 2 Changed: 2 Warnings: 0
- mysql> flush privileges;
- Query OK, 0 rows affected (0.02 sec)
- mysql> exit
- Bye
- 最后重启mysql server就可以了。
- root@gaurav:~# /etc/init.d/mysql start
- Starting MySQL database server: mysqld.
- Checking for corrupt, not cleanly closed and upgrade needing tables..
- 用新密码登陆验证下
- root@gaurav:~# mysql --user=root --pass=new-password-here
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 5 to server version: 5.0.24a-Debian_4-log
- Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
- mysql> exit
- Bye
如何重置mysql的密码的更多相关文章
- MAC 重置MySQL root 密码
重置MySQL root 密码:当忘记密码,或者想要强行重置 MySQL 密码的时候,可以像下面这样: 1.停止 MySQL 服务 sudo /usr/local/mysql/support-file ...
- 如何在linux中重置Mysql访问密码
目录 跳过密码认证 重启MySQL: 用sql来修改root的密码 去掉'跳过密码'代码 假设我们使用的是root账户. 跳过密码认证 重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: # ...
- 重置mysql管理员密码
重置管理员密码 1.关闭mysql 2.开启mysql,跳过授权表mysql服务 提示:如果此步骤操作成功,那么任何用户登陆MySQL都不需要用户名与密码 保持此窗口不能关闭 3.重新cmd,登陆 m ...
- Mac - MySQL初始密码忘记重置MySQL root密码
在什么情况下,需要重置root密码呢?那就是我们忘记了.还有一种比较坑的,那就是笔者的这种情况.按照正常的情况下,MySQL安装完之后,会弹出一个对话框,显示着一个临时的root密码,但无论笔者如何重 ...
- 重置mysql数据库密码
# /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # my ...
- 重置mysql数据库密码相关方法
方法一: 在my.ini的[mysqld]字段加入:skip-grant-tables重启mysql服务,这时的mysql不需要密码即可登录数据库 然后进入mysqlmysql>use mysq ...
- xampp集成环境下重置mysql的密码
第一步:打开两个命令行工具,都进入到你的xampp安装目录下的mysql下的bin目录,如我安装的位置是D:xampp/mysql/bin: 第二步:在完成第一步的情况下,输入:mysqld --sk ...
- xampp集成包如何重置mysql的密码
转自:http://blog.sina.com.cn/s/blog_4b2bcac501013s4l.html 安装使用xampp,装好后root默认没有密码,phpmyadmin是用config文件 ...
- mac 重置mysql root密码
1. 关闭mysql服务 sudo /usr/local/mysql/support-files/mysql.server stop 如果出现Starting mysqld daemon with d ...
随机推荐
- WIN7下更改TFS连接用户的方法
如果你在第一用VS连接TFS的时候,当你输入完用户名和密码并点击保存时,你的用户登录信息就保存在Credential Manager. 你可以到 Control Panel->User Acco ...
- XHR2 和[FromBody]使用说明
[FromBody]必须是application/json 否则会报415 不支持的类型 //Forms function FormsPost(data) { //Default Type x-www ...
- ccpc 2016 省赛
1.configuration if ide. 2.file import and export. 3.check your program more than once. ============= ...
- MongoDb系列
这个系列主要总结学习MongoDb过程中的一些经验. 简单介绍及环境搭建 常用命令 C#驱动及应用 管理工具MongoVUE使用
- 在Excel中引用其他宏
在excel的使用过程中,会用到一些自定义函数,可以使用宏轻松的实现这些功能,问题是必须使用“启用宏的excel”,这样用户每次打开时都要启用宏. 现用以按背景色计划为例,解决以上问题: 1.新建一个 ...
- Iterator之ListIterator简介
ListIterator是什么? (参考自百度百科) java中的ListIterator在Iterator基础上提供了add.set.previous等对列表的操作.但是ListIterator跟I ...
- 小记:获取post和get请求。
package com.lixu.httpget_post; import java.io.ByteArrayOutputStream; import java.io.IOException; imp ...
- 用户列表-投资记录sql
--普通标.定向标.新手标.老互融计划-投资记录表select bid.borrow_id, (select yyb.borrow_valid_time from YYD_Borrow_BorrowI ...
- mac下安装apache+php+mysql
运行“sudo apachectl start”,再输入帐号密码,这样Apache就运行了. 运行“sudo apachectl -v”,你会看到Mac OS X 10.6.3中的Apache版本号: ...
- Jquery easyui datagrid 导出Excel
From:http://www.cnblogs.com/weiqt/articles/4022399.html datagrid的扩展方法,用于将当前的数据生成excel需要的内容. 1 <sc ...