rsmartapps Posted September 7, 2016 Share 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 Quote Link to comment Share on other sites More sharing options...
wolstech Posted September 7, 2016 Share 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. Quote Link to comment Share on other sites More sharing options...
rsmartapps Posted September 7, 2016 Author Share Posted September 7, 2016 Ok will do it and I'll let know if that worked Quote Link to comment Share on other sites More sharing options...
rsmartapps Posted September 7, 2016 Author Share 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 Quote Link to comment Share on other sites More sharing options...
Krydos Posted September 7, 2016 Share 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? Quote Link to comment Share on other sites More sharing options...
rsmartapps Posted September 7, 2016 Author Share 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. Quote Link to comment Share on other sites More sharing options...
Krydos Posted September 8, 2016 Share Posted September 8, 2016 Where is your test file located? Quote Link to comment Share on other sites More sharing options...
rsmartapps Posted September 8, 2016 Author Share 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 Quote Link to comment Share on other sites More sharing options...
Krydos Posted September 8, 2016 Share Posted September 8, 2016 You probably just had something typed not quite right. Glad you got it working. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.