重置/更改mysql root密码

时间:2015-02-05 10:40:34

标签: mysql wamp bitnami

如何在bitnami wamp stack中重置/更改mysql root密码?

我试着这个solution,但这不适合我。在bitnami文件夹中没有文件 \ bin \ mysqld-nt.exe

2 个答案:

答案 0 :(得分:1)

解决问题:

1。 停止服务wampstackMySQL(从“开始”菜单中选择“控制面板”,然后选择“管理工具”,再选择“服务”)

1。 在windows cmd代码中:

  

E:\ Bitnami \ wampstack-5.4.34-0 \ mysql \ bin \ mysqld.exe --defaults-file = E:\ Bitnami \ wampstack-5.4.34-0 / mysql \ my.ini wampstackMySQL - init-file = E:\ mysql-init.txt

mysql-init.txt代码:

  

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

2。 使用新的root密码

通过workbench连接到mysql服务器

3。 重启PC或重启服务wampstackMySQL

4。 删除文件mysql-init.txt

答案 1 :(得分:0)

ankichan@ankichan-HP-Notebook:~$ mysql -u root -p
Enter password: 
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Then do the following steps:
    Execute bash as root
    sudo bash
    Enter the regular password of your user
    Change root password using:
    passwd root

这将允许您设置root密码 例如。

ankichan@ankichan-HP-Notebook:~$ sudo bash
[sudo] password for ankichan: 
root@ankichan-HP-Notebook:~# passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

root@ankichan-HP-Notebook:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13