如何修改ubuntu服务器的MySQL root密码和用户名?我需要停止mysql服务之前,设置任何更改?
我有一个phpmyadmin设置以及,phpmyadmin会自动更新?
如何修改ubuntu服务器的MySQL root密码和用户名?我需要停止mysql服务之前,设置任何更改?
我有一个phpmyadmin设置以及,phpmyadmin会自动更新?
当前回答
如果你想修改MySQL root密码,在终端输入:
Sudo dpkg-reconfigure mysql-server-5.5
MySQL守护进程将被停止,并提示您输入新密码。
其他回答
Instead of resetting the password there is a work around on the local machine if you have setup phpmyadmin to connect without giving the password or username. Check this out by starting mysql, apache etc. I have xampp installed in my local machine. So starting the xampp will start all the necessary services. Now going to http://localhost/phpmyadmin shows me all the databases. This confirms that you have saved the username and passsword in the config file of phpmyadmin which can be found in the phpmyadmin install location. If you have xampp installed the phpmyadmin folder can be found in the root folder of xampp installation. Search for the word password in the config.inc.php file. There you will find the password and username.
官方和简单的方法来重置根密码在ubuntu服务器…
如果你在16.04 14.04 12.04
sudo dpkg-reconfigure mysql-server-5.5
如果你在10.04:
sudo dpkg-reconfigure mysql-server-5.1
如果您不确定安装了哪个mysql-server版本,您可以尝试:
dpkg --get-selections | grep mysql-server
mysql-server-5.7的更新说明
请注意,如果您使用的是mysql-server-5.7,则不能使用上面所示的更简单的dpkg-reconfigure方法。
如果你知道密码,登录并运行这个:
UPDATE mysql.user SET authentication_string=PASSWORD('my-new-password') WHERE USER='root';
FLUSH PRIVILEGES;
或者,您可以使用以下方法:
sudo mysql_secure_installation
这将询问您一系列关于保护安装的问题(强烈推荐),包括是否需要提供新的根密码。
如果你不知道root密码,请参考这个以ubuntu为中心的进程写上去。
查看更多信息:
https://help.ubuntu.com/16.04/serverguide/mysql.html https://help.ubuntu.com/14.04/serverguide/mysql.html
当更改/重置MySQL密码时,上面列出的以下命令没有帮助。我发现进入终端并使用这些命令是毫无意义的。相反,使用命令sudo停止一切。如果有帮助的话,删除windows的system32。
您可以使用该命令:
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
之后请冲洗:
FLUSH PRIVILEGES;
如果你想修改MySQL root密码,在终端输入:
Sudo dpkg-reconfigure mysql-server-5.5
MySQL守护进程将被停止,并提示您输入新密码。