0

I am trying to connect to MySQL through the command prompt. But I always get "access is denied for 'admin'@'localhost' user." (Error 1045).

This MySQL is running on Windows 2012 R2 server. There I have two instances of MySQL server running on different ports: one for Plesk database on port 8306, and another is for Client database (to which I am trying to connect) on the usual port 3306.

As specified here : http://kb.sp.parallels.com/en/427 I am using the respective username and password.

And I am running this command: mysql -uadmin -p*** -P3306. But it gives me Access denied error.

I would be really grateful if someone can suggest What can be the reason behind this error.

1 Answers1

1

If you can connect locally with something else like php then your credentials may not have remote access.

What else you can do: - Make sure that there is no firewall blocking access to MySQL.

  • Make sure that the server has not been configured to ignore network connections. If the serverstarted with --bind-address=127.0.0.1 it will not accept TCP connections.

  • Make sure grant tables are initialized. If not, do it manually.

  • Run the mysql_upgrade script if you made any recent updates.

  • Check environment variables. They may contain invalid default connectivity parameters.

  • Did you use PASSWORD() for changing password ? If you used SET PW / INS /UPD it will not work.

Incorrect

SET PASSWORD FOR 'q'@'hostname' = 'pas';

Correct:

SET PASSWORD FOR 'q'@'hostname' = PASSWORD('pas');
  • Check user table by executing mysql -u root mysql and issuing this SQL statement:

    SELECT * FROM user;

You should have a row with the host and user columns matching your client's hostname and your MySQL username.

There are more deeper things that can be tested, but usually it's something of the above.

Overmind
  • 3,221