PHP connection problems with Mysql.(Access denied for user)

Asked

Viewed 1,673 times

1

I am a beginner in the area that refers to programming and computers. I have a problem that I can’t get the solution anywhere.

I have a Linux virtual machine with a Mysql server to supply the Zabbix Server monitoring tool (which is already installed on the virtual machine). From my physical machine (Windows) I created an SSH tunnel through Putty, so I can connect PHP (which I installed via Xampp) to the virtual machine Mysql:

<?php
   $link = mysql_connect('127.0.0.1:3310','root','senha');
?>

The connection is made, but Mysql returns me that the password or user is wrong:

Warning: mysql_connect(): Access denied for user 'root'@'srv-Gui' (using password: YES) in C: xampp htdocs Zabbix index.php on line 2

The user and password are correct, this is true, since I can access the Mysql console with the same.

I appreciate the help!

  • Ever tried to replace '127.0.0.1:3310'for localhost ?

  • Have you checked if the user is enabled to access from any machine? by default if I’m not mistaken it comes only to the machine that is installed access using that user

  • Jeferson how can I enable? Thanks for your help!

  • I tried William! But I did not succeed. Thanks for the help!

1 answer

-1


Tries to give the user access remotely

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' 
    IDENTIFIED BY 'YOUR_PASS' 
    WITH GRANT OPTION;
FLUSH PRIVILEGES;  

Browser other questions tagged

You are not signed in. Login or sign up in order to post.