在ubuntu中更改mysql数据库的密码

时间:2015-07-17 05:23:53

标签: mysql ubuntu

如何更改mysql数据库密码?

2 个答案:

答案 0 :(得分:1)

在Ubuntu Linux上设置/更改/重置MySQL root密码。在终端中输入以下行。 停止MySQL服务器。

sudo /etc/init.d/mysql stop

启动mysqld配置。

`sudo mysqld --skip-grant-tables` &

以root身份登录MySQL。

mysql -u root mysql

用新密码替换YOURNEWPASSWORD!

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;

答案 1 :(得分:1)

在Ubuntu Linux上设置/更改/重置MySQL root密码

经过测试 - Ubuntu Linux 7.10 Gutsy Gibbon和MySQL 5.0.45。 (2007-10-21) - Ubuntu Linux 6.06 Dapper Drake和MySQL 4.1.15。

http://ubuntu.flowconsult.at/en/mysql-set-change-reset-root-password/