Access denied for user 'test' @ 'ip' (using password: YES)

I found a lot of posts for this error, tried everything, but still got the same error. I am trying to connect to mysql on an ubuntu server from my remote application and mysql client. Let me post all the steps I took:

  • Stop the firewall on the ubuntu server: iptables -F. Also tried using sudo service ufw stop.
  • Commented on "bind-address" in /etc/mysql/my.cnf and restarted mysql.
  • User added in mysql: CREATE USER 'test' @ '%' IDENTIFIED BY 'testpwd';
  • GRANT ALL PRIVILEGES. TO 'test' @ '%' IDENTIFIED 'testpwd' with the GRANT option;
  • PRIVILEGES OF FLUSH;
  • I see a new user record using "Select host, user from mysql.user";
  • restarted mysql again. Still the same mistake!
  • Now I thought that there might be a problem with the firewall, so added: iptables -A INPUT -i eth0 -p tcp -destination-port 3306 -j ACCEPT The problem still persists. Help will be really appreciated, otherwise I will be in serious trouble.
+4
source share
2 answers

"Access denied for user 'test' @ 'ip' (using password: YES)" is a MySQL error.

, , , . , , , .. .., ; ..

"" .

( ) :

USE mysql;
SELECT User, Host, Password from user WHERE User = 'test';

, IP- ( IP, ), DNS, - , , , , ).

/ . , :

user      host     password
test      1.2.3.4  foo

,

GRANT... TO test@'%' ... PASSWORD bar

... , 1.2.3.4, "foo".

( ):

, . IP- . ( IP- , 192.168.1.13 192.168.1.0/255.255.255.0 .) "%" " " . '' " ", "%". ( " " ). Host User, .

,

USE mysql;
DELETE FROM user WHERE User = 'test';
GRANT ALL PRIVILEGES ON database.* TO 'test'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

, , "".

( , GRANT , ,

GRANT ALL PRIVILEGES ON databasename.*

)


( )

: IP- , , 192.168.1.13 192.168.1.0/255.255.255.0 .

127.0.0.1/0.0.0.0 ( ) localhost. netmask, , , %, , .

test     bar         %           
test     localfoo    127.0.0.1/0.0.0.0

, test "" , "localfoo".

, .

+5

- / . MySql -skip-grant-tables, .

0

Source: https://habr.com/ru/post/1624702/


All Articles