在本地 mysql 实例上创建用户的正确方法?
Correct method to create a user on a local mysql instance?
想知道这两种 CREATE USER 方法之间的区别。
create user 'greg'@'local' identified by 'password952';
或会
create user 'greg' identified by 'password952';
够了吗?
这两个都可以在本地 MySQL 安装上进行测试。不过,一般来说,正确 创建用户帐户 MySQL 的方法是这样的:
CREATE USER 'greg'@'localhost'
IDENTIFIED WITH mysql_native_password BY 'superSecretPassword!123';
如果MySQL中没有使用原生密码功能,那么可以移除WITH mysql_native_password
。不过,许多 MySQL 8.x 安装默认启用它。
想知道这两种 CREATE USER 方法之间的区别。
create user 'greg'@'local' identified by 'password952';
或会
create user 'greg' identified by 'password952';
够了吗?
这两个都可以在本地 MySQL 安装上进行测试。不过,一般来说,正确 创建用户帐户 MySQL 的方法是这样的:
CREATE USER 'greg'@'localhost'
IDENTIFIED WITH mysql_native_password BY 'superSecretPassword!123';
如果MySQL中没有使用原生密码功能,那么可以移除WITH mysql_native_password
。不过,许多 MySQL 8.x 安装默认启用它。