首页 > 解决方案 > ubuntu 如何将用户更改为“mysql”

问题描述

我的环境

Ubuntu 20 mysql 8

我正在尝试做的事情

我正在阅读这篇文章来更改 mysql 的 root 密码。

https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html

B.3.3.2.2 Resetting the Root Password: Unix and Unix-Like Systems
...

The instructions assume that you start the MySQL server from the Unix login account that you normally use for running it. For example, if you run the server using the mysql login account, you should log in as mysql before using the instructions.

所以它必须是一种将操作系统用户更改为“mysql”的方法

我做了什么

所以我做到了sudo paasswd mysql。我设置了密码

和...cat /etc/shadow

mysql:<newly created hash>:18650:0:99999:7:::

我试过了su - mysql

su: warning: cannot change directory to /nonexistent: No such file or directory

并且没有改变用户。

问题

将操作系统用户更改为的适当方法是mysql什么?

标签: mysqlubuntu

解决方案


推荐阅读