gpt4 book ai didi

mysql - 尽管授予特权,但 mysql 访问仍被拒绝

转载 作者:行者123 更新时间:2023-11-30 22:31:05 25 4
gpt4 key购买 nike

我想执行指令来创建和操作数据库,所以首先我创建了一个用户,如下所示:

shell>cd program\xampp\mysql\bin;
shell>mysql -u root -h localhost
mariadb[(none)]>create user 'iw3htp@localhost'identified by 'sth';
grant all privileges on *.* to 'iw3htp@localhost';
flush privileges;

但是当我想执行使用源文件或手动创建和操作数据库的指令时,我遇到错误 1044,提示我“拒绝用户 'iw3htp'@'localhost' 访问数据库 foo。

这有什么问题吗?我必须做什么?

最佳答案

用户访问由用户名和主机定义。两部分。

有了这个:

create user 'iw3htp@localhost' ...

作为一个字符串你已经创建了一个用户

'iw3htp@localhost'@localhost

改成

create user 'iw3htp'@'localhost' identified by 'sth';

grant all privileges on *.* to 'iw3htp'@'localhost';

关于mysql - 尽管授予特权,但 mysql 访问仍被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33891797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com