<分区>
Possible Duplicate:
How do I change the password of the root user in MySQL?
我有 ec2 实例的根访问权限,但我不知道我需要的 mysql 根密码是什么。我将如何 1) 找到这个?或者 2) 重新安装 mysql 并给自己一个 root 密码?
<分区>
Possible Duplicate:
How do I change the password of the root user in MySQL?
我有 ec2 实例的根访问权限,但我不知道我需要的 mysql 根密码是什么。我将如何 1) 找到这个?或者 2) 重新安装 mysql 并给自己一个 root 密码?
最佳答案
$ sudo service mysql stop
$ /usr/bin/mysqld_safe --skip-grant-tables &
mysql -h localhost
> use mysql
> update user set password = password('') where user = 'root' and host='localhost';
> quit
$ sudo service mysql start
$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
关于mysql - 通过对服务器的 root 访问权限,我将如何更改 mysql root 密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10791842/