Jump to content

Recommended Posts

Posted

Hello dear team,

 

I am a grateful user to use your services. They are great to people like me.

 

I'm trying to connect to my database (mysql) through a php script, but I'm replied with this:

Access denied for user 'rsmartap'@'localhost' (using password: YES)

Please could you point me in the rigth direction?

 

Point that I'm login correctly through phpMyAdmin.

 

I hope you guys can sort this out.

 

Regards,

Ruben

 

Posted

I assume you're using the right password? Create a new database user, assign it to the database you're trying to use, then try using those credentials instead if your cpanel account to access the database.

Posted

Hello wolstech,

 

That worked thanks you very much, took me a while because I'm not used to this panel but works perfecty when I connect remotely, but when I do it through my script does not work.

 

$mysqli = new mysqli('localhost', 'rsmartap_php', 'password', 'rsmartap_encuesta');
if($mysqli->connect_errno) {
die('No pudo conectarse: ' . mysql_error());
}

 

Here are part of the script.

I'm doing something wrong?

Shall I code this in a different way?

 

Please remmember that I'm learning.

 

Regards,

Rsmartapps

Posted

That code looks fine to me. Does the mysql user rsmartap_php have permissions on rsmartap_encuesta? Are you using the correct password for rsmartap_php?

Posted

Yes, I added the user to the database and gave full permissions.

 

To check if I could connect from home I added my ip, so I connected with the same user/password successfully.

 

I don't know what else try.

 

I will make sure the typography to ensure there are not mistakes.

 

Expecting to find out what I'm doing wrong.

Posted

Public/encuesta/file.php

 

I tried a simple phpinfo() and worked perfectly.

 

Well I decided to retype all content to do the conection and is sorted.

 

I don't know if is casuallity or is because you guys fixed something,

 

Thaks for your help

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...