很多人利用phpmyadmin或者命令行来修改了mysql的root密码,重启后发现mysql登录错误,这是为什么呢?修改mysql的root的密码要在mysql软件中mysql数据库里修改root的密码,还要在配置文件中修改。而且在数据库中的修改不止修改一行数据,所以千万不要手动修改,要用命令来修改。
本文帮助读者解决用phpmyadmin修改root密码问题和用phpmyadmin更改root密码后无法登陆问题
首先用root账号登陆phpmyadmin,然后点击左侧进入mysql数据库,在顶部点击“mysql”进入sql输入界面。输入以下命令:
update user set password=password(‘123456′) where User=’root’
其中123456为你希望修改的密码,切记不要在数据库中直接手工修改密码。
修改mysql数据库root密码
然后点击右下角的“执行”,看到如下界面,就表示修改成功。(注意:有的mysql这里影响的列数并不是2)
phpmyadmin修改mysql数据库root密码成功
接着还要进入phpmyadmin目下下的libraries目录,修改config.default.php文件。找到$cfg[‘Servers’][$i][‘password’]  = ‘ ‘,
修改为$cfg[‘Servers’][$i][‘password’]      = ‘123456’;    123456就是您想要的密码。重启mysql后新密码生效。
如果安装了wordpress,需要修改wordpress的配置文件(此处只需修改密码)
设置 wp-config.php
为了继续进行以下环节,请你找到以下代码并进行修改:
返回到你在第一步时解压WordPress包的地方,重命名wp-config-sample.php文件为wp-config.php. 用你喜欢的编辑器打开已经重命名的wp-config.php并且填写好以下信息,例如:
DB_NAME
你在第二步时为WordPress建立的数据库名称。
DB_USER
你在第二步建立WordPress数据库时创建的用户名。
DB_PASSWORD
你在第二步时为你数据库用户所创建的密码。
DB_HOST
你在第二步时决定的主机名(通常时localhost,但也不是绝对,请根据实际情况填写)。 保存文件。

21 对 “利用phpmyadmin修改mysql的root密码”的想法;

  1. I’m really impressed together with your writing talents
    as well as with the structure for your blog. Is that this a
    paid subject or did you modify it your self? Anyway
    stay up the nice quality writing, it is rare to see a great
    blog like this one nowadays..

  2. We are a group of volunteers and opening a new scheme
    in our community. Your website offered us with valuable info to work on. You’ve
    done an impressive job and our entire community will be thankful to you.

  3. I savour, lead to I discovered just what I used to be looking for.
    You’ve ended my four day long hunt! God Bless you man. Have a great day.
    Bye

  4. This design is spectacular! You definitely know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start my
    own blog (well, almost…HaHa!) Great job. I really loved what you had to say,
    and more than that, how you presented it. Too cool!

  5. Hmm it appears like your site ate my first comment (it was super long) so I guess I’ll just
    sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog writer but I’m still new to the whole thing.

    Do you have any tips and hints for first-time blog writers?
    I’d definitely appreciate it.

发表评论

电子邮件地址不会被公开。 必填项已用*标注