如何重置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 ...
随机推荐
- 3.7 嵌入式SQL
可以放入所有高级语言中去,如C 因为,SQL是过程性语句,需要高级语言的非过程性处理集合的分类处理 一.一般形式 所有的SQL语句都必须加前缀EXEC SQL SQL语句完成结束标志(:或END EX ...
- 【转载】JSP中文乱码问题
原作者http://www.cnblogs.com/xing901022/p/4354529.html 阅读目录 之前总是碰到JSP页面乱码的问题,每次都是现在网上搜,然后胡乱改,改完也不明白原因. ...
- JButton计数
1.引言 在Swing窗口中,我们时常会点击按钮进行计数,例如点击按钮A,第一次弹出窗口1,第二次弹出窗口2....以及按钮的快捷键设置. import java.awt.event.ActionEv ...
- c# 中的委托以及匿名方法lambda
1.委托的定义internal delegate int MyAddFunDe(int a,int b)2.匿名方法1)MyAddFunDe fun = delegate(int a,int b){ ...
- bash: sqlplus: command not found 解决方法
在oracle用户下输入:sqlplus 抛出bash: sqlplus: command not found 解决办法: 在root用户下输入如下命令: ln -s $ORACLE_HOME/bin ...
- jQuery实现图片延迟加载
html: <img src ="占位图路径" data-original="真实图片路径" /> js: $("img").l ...
- Time, Clocks, and the Ordering of Events in a Distributed System
作者:Leslie Lamport(非常厉害的老头了) 在使用消息进行通信的分布式系统中,使用物理时钟对不同process进行时间同步与事件排序是非常困难的.一是因为不同process的时钟有差异,另 ...
- 一天完成把PC网站改为自适应!原来这么简单!
http://www.webkaka.com/blog/archives/how-to-modify-a-web-page-to-be-responsive.html 一天完成把PC网站改为自适应!原 ...
- UVa 11427 - Expect the Expected
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- DataGridView复选框实现单选功能(二)
双击DataGridView进入事件 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventA ...