estatec Posted September 2, 2011 Share Posted September 2, 2011 I got this error message "Access denied for user 'estatec'@'localhost' (using password: NO)" and Im not sure why because I had configured all the data in a file named "datosconeccion.php" that just contains all conection data and it looks like this: <? $dbServer = 'localhost'; $dbUser = 'estatec'; $dbPassword = '********'; $dbName = '*******'; ?> Then in the main script I have something like this <?php include("/datosconeccion.php"); $mysql = mysql_connect($dbServer, $dbUser, $dbPassword) or die(mysql_error()); mysql_select_db( $dbName ); Im using version 5.2.17 of PHP. I tried to declare the same vars in the main script and it worked so Im not really sure why with the include is not working. Any help will be really apreciated Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/ Share on other sites More sharing options...
AyKay47 Posted September 2, 2011 Share Posted September 2, 2011 the user for localhost is "root".. can we see where you changed the settings.. Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264731 Share on other sites More sharing options...
estatec Posted September 2, 2011 Author Share Posted September 2, 2011 Since Im on a shared webserver I have no access to the root account for security reasons but as I mentioned before if I just copy the info in "datosconeccion.php" $dbServer = 'localhost'; $dbUser = 'estatec'; $dbPassword = '********'; $dbName = '*******'; and paste it in the same document before the sql query it works even if I just hardcode the password it works. I mean the include includes all data except the password and Im starting to become crazy ): Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264733 Share on other sites More sharing options...
AyKay47 Posted September 2, 2011 Share Posted September 2, 2011 well your user is wrong, because it doesn't have access.. Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264737 Share on other sites More sharing options...
estatec Posted September 2, 2011 Author Share Posted September 2, 2011 man are you READING Im sorry. This is the third time I say that the same username and password, even server and database was moved to the same script as the one that connects to the database and when I did that IT WORKED so..... the username has permissions and the password is typed correctly. The only trouble Im having is that when I copy the same data to another script (for security reasons) and I try to use include it seems to include all the conection data except the password. How do I know this? because if it were not including it how does the php knows that the username is estatec and the hostname is localhost. What makes me freak out is that it says passord NO and I did typed a password and it is correct in the external script. To be more explicit when I said I moved the data to the same script what I did was this: <?php $dbServer = 'localhost'; $dbUser = 'estatec'; $dbPassword = '********'; $dbName = '*******'; $mysql = mysql_connect($dbServer, $dbUser, $dbPassword) or die(mysql_error()); mysql_select_db( $dbName ); Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264740 Share on other sites More sharing options...
salathe Posted September 2, 2011 Share Posted September 2, 2011 Change <? to <?php in your datosconeccion.php file. Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264746 Share on other sites More sharing options...
estatec Posted September 2, 2011 Author Share Posted September 2, 2011 Thank you very much man it worked (: I just can't explain myself why because in my php.ini short_open_tag is set to On. But anyways this fixed my problem and I appreciate it once again Thank you and I hope you have a nice day Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264757 Share on other sites More sharing options...
fenway Posted September 2, 2011 Share Posted September 2, 2011 Never use short tags. Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1264814 Share on other sites More sharing options...
premiso Posted September 5, 2011 Share Posted September 5, 2011 Never use short tags. Goonies never say die. Quote Link to comment https://forums.phpfreaks.com/topic/246278-access-denied-for-user-estateclocalhost-using-password-no/#findComment-1265770 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.