greaterthanme Posted December 30, 2006 Share Posted December 30, 2006 Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'username'@'localhost' (using password: YES) in /home/admin/public_html/me/NewG/html/setup.php on line 21Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/admin/public_html/me/NewG/html/setup.php on line 22Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/admin/public_html/me/NewG/html/setup.php on line 22Could not connect to database[hr]What's the problem here? :S:S Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/ Share on other sites More sharing options...
448191 Posted December 30, 2006 Share Posted December 30, 2006 Don't kill yourself, use the right credentials. ;) Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150045 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 what does this suppose to mean? Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150055 Share on other sites More sharing options...
dbo Posted December 30, 2006 Share Posted December 30, 2006 Pretty clear error message. Your username/password combination is incorrect. Since this fails and you don't do extra checking the other functions that rely on a db connection also fail. Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150066 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 This is what i have in the setup.php page from lines 15-22[hr]//////DATABASE CONFIG, AND CONNECTION$db[host] = 'localhost'; //DATABASE HOST "Default is localhost"$db[user] = 'username'; //DATABASE USERNAME$db[pass] = 'password'; //DATABASE PASSWORD$db[name] = 'admin_dbname'; //DATABASE NAME$connect = mysql_connect($db[host],$db[user], $db[pass]);mysql_select_db("$db[name]") or die ("Could not connect to database");[hr]What do I have to add to database.sql? Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150072 Share on other sites More sharing options...
simcoweb Posted December 30, 2006 Share Posted December 30, 2006 replace those tags for each of those to the proper name/username/password/host Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150075 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 huh!? replace what? where? Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150077 Share on other sites More sharing options...
AV1611 Posted December 30, 2006 Share Posted December 30, 2006 You might want to make sure you have setup MySQL with a valid account and that you actually know how to log on to it... Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150078 Share on other sites More sharing options...
dbo Posted December 30, 2006 Share Posted December 30, 2006 Well I would make them all: $db['host'] = 'localhost'; $db['user'] = 'username';.... etc just b/c the way you have it is ugly imo :p. If you are sure the credentials are right I would suggest that you echo each of the variables to verify their contents are what you expect. For example:echo "localhost == " . $db['host'] . "\n"; Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150079 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 still can't get it... can anybody just talk to me at msn? i'll give him full info... it's urgent please Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150082 Share on other sites More sharing options...
dbo Posted December 30, 2006 Share Posted December 30, 2006 Try connecting to the database using phpMyAdmin or MySQL Query Browser/Administrator and see what happens. Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150084 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 ahaaawhen I try to import database.sql to PhpMyadmin it says this#1050 - Table 'bans' already exists and when I try and rename the table it give another table that exist and so on! Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150088 Share on other sites More sharing options...
dbo Posted December 30, 2006 Share Posted December 30, 2006 No idea what that means, but apparently you can connect to the db with the credentials in your code? Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150090 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 no, I can't even import the database to create it on server! Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150094 Share on other sites More sharing options...
dbo Posted December 30, 2006 Share Posted December 30, 2006 I'm not talking about an import. I'm talking about you typing in your username and password and the interface opening up and not giving you an error message because your credentials suck. Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150095 Share on other sites More sharing options...
simcoweb Posted December 30, 2006 Share Posted December 30, 2006 Ok, this is PHP/MySQL 101:FIRST: You must have a MySQL database. Do you? If not, you need to create one. Your hosting provider either a) provides you with some method of creating one, or b) creates one for you, or c) provides you with an address to oneSECOND: That bit of code in your script has to be modified to point to the actual database you are trying to access.[quote]//////DATABASE CONFIG, AND CONNECTION$db[host] = 'localhost'; //DATABASE HOST "Default is localhost"$db[user] = 'username'; //DATABASE USERNAME$db[pass] = 'password'; //DATABASE PASSWORD$db[name] = 'admin_dbname'; //DATABASE NAME$connect = mysql_connect($db[host],$db[user], $db[pass]);mysql_select_db("$db[name]") or die ("Could not connect to database");[/quote]Where it says $db[host] = 'localhost' as an example, you need to make sure that 'localhost' is the actual location of your database. It could be 'mysql.atmyhostproviders.com' or whatever. But, whatever it is, you need to enter it there by replacing the word 'localhost'. Same with those other variables. I doubt seriously if your database's username is 'username'. Plug in the actual username there. Same goes for the password.THIRD: EVERY database has a name. Plug that in to the $db[name] = 'admin_dbname' spot. Then you should be able to connect. Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150100 Share on other sites More sharing options...
greaterthanme Posted December 30, 2006 Author Share Posted December 30, 2006 MY MISTAKE! Link to comment https://forums.phpfreaks.com/topic/32318-solved-errr-a-n00bie-will-kill-himself-soon/#findComment-150111 Share on other sites More sharing options...
Recommended Posts