Mysql 尽管授予特权,我的sql访问仍被拒绝

Mysql 尽管授予特权,我的sql访问仍被拒绝,mysql,database,web,Mysql,Database,Web,我想执行创建和操作数据库的指令,因此首先我创建了一个用户,如下所示: 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; 但是

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

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';


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

为此:

create user 'iw3htp@localhost' ...
作为单个字符串,您已经创建了一个用户

'iw3htp@localhost'@localhost
换成

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