1. 如何重置mysql的密码
  2. 如果知道密码,则通过以下方式修改;
  3. gaurav@gaurav:~$ mysql --user=root --pass mysql
  4. Enter password:
  5. mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';
  6. Query OK, 2 rows affected (0.04 sec)
  7. Rows matched: 2  Changed: 2  Warnings: 0
  8. mysql> flush privileges;
  9. Query OK, 0 rows affected (0.02 sec)
  10. mysql> exit
  11. Bye
  12. 如果忘记密码,则先停止mysql,然后加上参数skip-grant-tables重新启动mysql server
  13. root@gaurav:~# /etc/init.d/mysql stop
  14. Now you should start up the database in the background, via the mysqld_safe command:
  15. root@gaurav:~# /usr/bin/mysqld_safe --skip-grant-tables &
  16. [1] 4271
  17. Starting mysqld daemon with databases from /var/lib/mysql
  18. mysqld_safe[6763]: started
  19. 然后登陆mysql,修改密码
  20. root@gaurav:~$ mysql --user=root mysql
  21. Enter password:
  22. mysql> update user set Password=PASSWORD('new-password-here') WHERE User='root';
  23. Query OK, 2 rows affected (0.04 sec)
  24. Rows matched: 2  Changed: 2  Warnings: 0
  25. mysql> flush privileges;
  26. Query OK, 0 rows affected (0.02 sec)
  27. mysql> exit
  28. Bye
  29. 最后重启mysql server就可以了。
  30. root@gaurav:~# /etc/init.d/mysql start
  31. Starting MySQL database server: mysqld.
  32. Checking for corrupt, not cleanly closed and upgrade needing tables..
  33. 用新密码登陆验证下
  34. root@gaurav:~# mysql --user=root --pass=new-password-here
  35. Welcome to the MySQL monitor.  Commands end with ; or \g.
  36. Your MySQL connection id is 5 to server version: 5.0.24a-Debian_4-log
  37. Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
  38. mysql> exit
  39. Bye

如何重置mysql的密码的更多相关文章

  1. MAC 重置MySQL root 密码

    重置MySQL root 密码:当忘记密码,或者想要强行重置 MySQL 密码的时候,可以像下面这样: 1.停止 MySQL 服务 sudo /usr/local/mysql/support-file ...

  2. 如何在linux中重置Mysql访问密码

    目录 跳过密码认证 重启MySQL: 用sql来修改root的密码 去掉'跳过密码'代码 假设我们使用的是root账户. 跳过密码认证 重置密码的第一步就是跳过MySQL的密码认证过程,方法如下: # ...

  3. 重置mysql管理员密码

    重置管理员密码 1.关闭mysql 2.开启mysql,跳过授权表mysql服务 提示:如果此步骤操作成功,那么任何用户登陆MySQL都不需要用户名与密码 保持此窗口不能关闭 3.重新cmd,登陆 m ...

  4. Mac - MySQL初始密码忘记重置MySQL root密码

    在什么情况下,需要重置root密码呢?那就是我们忘记了.还有一种比较坑的,那就是笔者的这种情况.按照正常的情况下,MySQL安装完之后,会弹出一个对话框,显示着一个临时的root密码,但无论笔者如何重 ...

  5. 重置mysql数据库密码

    # /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # my ...

  6. 重置mysql数据库密码相关方法

    方法一: 在my.ini的[mysqld]字段加入:skip-grant-tables重启mysql服务,这时的mysql不需要密码即可登录数据库 然后进入mysqlmysql>use mysq ...

  7. xampp集成环境下重置mysql的密码

    第一步:打开两个命令行工具,都进入到你的xampp安装目录下的mysql下的bin目录,如我安装的位置是D:xampp/mysql/bin: 第二步:在完成第一步的情况下,输入:mysqld --sk ...

  8. xampp集成包如何重置mysql的密码

    转自:http://blog.sina.com.cn/s/blog_4b2bcac501013s4l.html 安装使用xampp,装好后root默认没有密码,phpmyadmin是用config文件 ...

  9. mac 重置mysql root密码

    1. 关闭mysql服务 sudo /usr/local/mysql/support-files/mysql.server stop 如果出现Starting mysqld daemon with d ...

随机推荐

  1. WIN7下更改TFS连接用户的方法

    如果你在第一用VS连接TFS的时候,当你输入完用户名和密码并点击保存时,你的用户登录信息就保存在Credential Manager. 你可以到 Control Panel->User Acco ...

  2. XHR2 和[FromBody]使用说明

    [FromBody]必须是application/json 否则会报415 不支持的类型 //Forms function FormsPost(data) { //Default Type x-www ...

  3. ccpc 2016 省赛

    1.configuration if ide. 2.file import and export. 3.check your program more than once. ============= ...

  4. MongoDb系列

    这个系列主要总结学习MongoDb过程中的一些经验. 简单介绍及环境搭建 常用命令 C#驱动及应用 管理工具MongoVUE使用

  5. 在Excel中引用其他宏

    在excel的使用过程中,会用到一些自定义函数,可以使用宏轻松的实现这些功能,问题是必须使用“启用宏的excel”,这样用户每次打开时都要启用宏. 现用以按背景色计划为例,解决以上问题: 1.新建一个 ...

  6. Iterator之ListIterator简介

    ListIterator是什么? (参考自百度百科) java中的ListIterator在Iterator基础上提供了add.set.previous等对列表的操作.但是ListIterator跟I ...

  7. 小记:获取post和get请求。

    package com.lixu.httpget_post; import java.io.ByteArrayOutputStream; import java.io.IOException; imp ...

  8. 用户列表-投资记录sql

    --普通标.定向标.新手标.老互融计划-投资记录表select bid.borrow_id, (select yyb.borrow_valid_time from YYD_Borrow_BorrowI ...

  9. mac下安装apache+php+mysql

    运行“sudo apachectl start”,再输入帐号密码,这样Apache就运行了. 运行“sudo apachectl -v”,你会看到Mac OS X 10.6.3中的Apache版本号: ...

  10. Jquery easyui datagrid 导出Excel

    From:http://www.cnblogs.com/weiqt/articles/4022399.html datagrid的扩展方法,用于将当前的数据生成excel需要的内容. 1 <sc ...