为什么从MySQL控制台插入MySQL.User表时"not insertable-into"错误?



从mysql控制台,我运行:

MariaDB [steve]> insert into mysql.user
->        (user,host,authentication_string,ssl_cipher,x509_issuer,x509_subject)
->        values('steve','localhost', PASSWORD('steve'), '','','');

得到错误:

ERROR 1471 (HY000): The target table user of the INSERT is not insertable-into

我以root用户登录:

PS C:Userssrich> C:xamppmysqlbinmysql -u root -p
Enter password:

如何从mysql控制台创建一个新的数据库用户?

用户被创建为数据库或表对象

CREATE USER 'user1'@localhost IDENTIFIED BY 'password1';
GRANT ALL PRIVILEGES ON *.* TO 'user1'@localhost IDENTIFIED BY 'password1'
FLUSH PRIVILEGES;

更多信息:https://mariadb.com/kb/en/create-user/

和https://mariadb.com/kb/en/grant/

最新更新