mysql root密码忘记了 [英] mysql root password forgotten

查看:79
本文介绍了mysql root密码忘记了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一段时间没有使用php mysql了,现在我需要再次使用它.但是问题是我忘记了mysql console的密码.尝试登录phpmyadmin时出现错误#1045. 在mysql网站上,我看到了一篇有关如何重置根密码的文章( http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-windows )

I did not use php mysql for quite a while and now I need to use it again.But problem is I forget the password for mysql console.and getting error #1045 when try to login in phpmyadmin. In mysql site I saw a article how to reset root password( http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-windows)

步骤是
创建一个包含UPDATE mysql.user的mysql-init.txt文件.SET Password = PASSWORD('newpass')WHERE User ='root'; 冲洗特权;

Steps are
create a mysql-init.txt file containing UPDATE mysql.user SET Password=PASSWORD('newpass') WHERE User='root'; FLUSH PRIVILEGES;

我将其保存为C:\ me \ mysql-init

I saved it as C:\me\mysql-init

在命令提示符下,我写了- C:\ wamp \ bin \ mysql \ mysql5.5.8 \ bin \ mysqld --init-file = C:\ me \ mysql-init.txt

and in command prompt I wrote-- C:\wamp\bin\mysql\mysql5.5.8\bin\mysqld --init-file=C:\me\mysql-init.txt

我也尝试了双反斜杠..但是它不起作用.mysql控制台正在要求输入密码并且没有使用新的一.我在做什么错?我在那里有几个表.该怎么办? 预先感谢.

I tried with double back slashes also..but it is not working.mysql console is asking for password and its not taking the new-one.What am I doing wrong?I have several tables there.what to do? Thanks in advance.

推荐答案

尝试使用--skip-grant-tables启动mysql

try to start mysql with --skip-grant-tables

mysqld --skip-grant-tables

然后使用mysql命令行不使用用户名/密码连接到mysqld

then connect to your mysqld without username/password using mysql command line

shell> mysql

然后发出命令

> mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
>        WHERE User='root'; mysql> FLUSH PRIVILEGES;

这篇关于mysql root密码忘记了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆