rsmartapps Posted September 7, 2016 Posted September 7, 2016 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
wolstech Posted September 7, 2016 Posted September 7, 2016 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.
rsmartapps Posted September 7, 2016 Author Posted September 7, 2016 Ok will do it and I'll let know if that worked
rsmartapps Posted September 7, 2016 Author Posted September 7, 2016 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
Krydos Posted September 7, 2016 Posted September 7, 2016 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?
rsmartapps Posted September 7, 2016 Author Posted September 7, 2016 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.
rsmartapps Posted September 8, 2016 Author Posted September 8, 2016 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
Krydos Posted September 8, 2016 Posted September 8, 2016 You probably just had something typed not quite right. Glad you got it working.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now