我在 Ubuntu 中运行 MySQL,默认安装。
我如何更改用户名root
对于另一个,比方说admin
?最好是从命令行。
连接MySQL后运行
use mysql;
update user set user='admin' where user='root';
flush privileges;
就是这样。
如果您还想更改密码,在 MySQL
update user set password=PASSWORD('new password') where user='admin';
before flush privileges;
。在 MySQL >= 5.7 中,password
领域中的user
表已重命名为authentication_string
,所以上面的行变成:
update user set authentication_string=PASSWORD('new password') where user='admin';
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)