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. 3.7 嵌入式SQL

    可以放入所有高级语言中去,如C 因为,SQL是过程性语句,需要高级语言的非过程性处理集合的分类处理 一.一般形式 所有的SQL语句都必须加前缀EXEC SQL SQL语句完成结束标志(:或END EX ...

  2. 【转载】JSP中文乱码问题

     原作者http://www.cnblogs.com/xing901022/p/4354529.html 阅读目录 之前总是碰到JSP页面乱码的问题,每次都是现在网上搜,然后胡乱改,改完也不明白原因. ...

  3. JButton计数

    1.引言 在Swing窗口中,我们时常会点击按钮进行计数,例如点击按钮A,第一次弹出窗口1,第二次弹出窗口2....以及按钮的快捷键设置. import java.awt.event.ActionEv ...

  4. c# 中的委托以及匿名方法lambda

    1.委托的定义internal delegate int MyAddFunDe(int a,int b)2.匿名方法1)MyAddFunDe fun = delegate(int a,int b){  ...

  5. bash: sqlplus: command not found 解决方法

    在oracle用户下输入:sqlplus 抛出bash: sqlplus: command not found 解决办法: 在root用户下输入如下命令: ln -s $ORACLE_HOME/bin ...

  6. jQuery实现图片延迟加载

    html: <img src ="占位图路径" data-original="真实图片路径" /> js: $("img").l ...

  7. Time, Clocks, and the Ordering of Events in a Distributed System

    作者:Leslie Lamport(非常厉害的老头了) 在使用消息进行通信的分布式系统中,使用物理时钟对不同process进行时间同步与事件排序是非常困难的.一是因为不同process的时钟有差异,另 ...

  8. 一天完成把PC网站改为自适应!原来这么简单!

    http://www.webkaka.com/blog/archives/how-to-modify-a-web-page-to-be-responsive.html 一天完成把PC网站改为自适应!原 ...

  9. UVa 11427 - Expect the Expected

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  10. DataGridView复选框实现单选功能(二)

    双击DataGridView进入事件 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventA ...