chopficaro Posted January 4, 2010 Share Posted January 4, 2010 Ive been trying to learn php, and Ive just gotten to the chapter about mysql and im trying to test it on my web site, which uses http://panel.byethost.com/ http://panel.byethost.com/ provides some mysql control, but i don't want to use it, i want to send every command through php, because im trying to learn php. so i grabbed some code from w3schools.com and inserted my username, password and mysql host name into it. i uploaded the code onto the server, ran it and got this error: Could not connect: Access denied for user 'space_4826174'@'192.168.0.110' (using password: YES) heres my code, or rather, the code from w3schools.com: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-… <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>mysql test</title> </head> <body> <?php $con = mysql_connect("sql307.000space.com","spa… if (!$con) { die('Could not connect: ' . mysql_error()); } if (mysql_query("CREATE DATABASE my_db",$con)) { echo "Database created"; } else { echo "Error creating database: " . mysql_error(); } mysql_close($con); ?> </body> </html> im absolutely sure that i have the correct username, password and host. anyone who uses http://panel.byethost.com/ knows that the mysql username and password are the same ones u use to log into cpanel or access via ftp. and once u log into http://panel.byethost.com/, it tells u right away what the mysql host is, here ill copy and paste it: MySQL hostname: sql307.000space.com so why did i get this error? Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/ Share on other sites More sharing options...
Deoctor Posted January 4, 2010 Share Posted January 4, 2010 hai i too use the byethost panel and i am able to connect without any problems.. if u can provide me with the connect string then i can help u out.. $con = mysql_connect("sql307.000space.com","spa… Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988019 Share on other sites More sharing options...
oni-kun Posted January 4, 2010 Share Posted January 4, 2010 Yes, replace your credentials with x's and show the whole code in case you presented an error (ie. invalid characters within string). What I'd recommend is just going into your panel and triple check your username for the sql not the specific sql database Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988020 Share on other sites More sharing options...
chopficaro Posted January 4, 2010 Author Share Posted January 4, 2010 hai i too use the byethost panel and i am able to connect without any problems.. if u can provide me with the connect string then i can help u out.. $con = mysql_connect("sql307.000space.com","spa… very well, this website is only being used for practice, and its free, so i dont really care if anyone messes with it here is the uncensored code, anyone is welcome to log in <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>mysql test</title> </head> <body> <?php $con = mysql_connect("sql307.000space.com","space_4826174","omgtkkyb"); if (!$con) { die('Could not connect: ' . mysql_error()); } if (mysql_query("CREATE DATABASE my_db",$con)) { echo "Database created"; } else { echo "Error creating database: " . mysql_error(); } mysql_close($con); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988032 Share on other sites More sharing options...
Deoctor Posted January 4, 2010 Share Posted January 4, 2010 are these ur correct login details, coz they are not working.. and also one more thing u cannot create a database with name my_db. the db should be of this format <username of byethost>_<database name> Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988034 Share on other sites More sharing options...
chopficaro Posted January 4, 2010 Author Share Posted January 4, 2010 they are, try logging in with them at panel.byethost.com Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988040 Share on other sites More sharing options...
Deoctor Posted January 4, 2010 Share Posted January 4, 2010 they are, try logging in with them at panel.byethost.com u have changed the password, previously it was given as censored.. anyway i have just now created one database for u check that out.. space_4826174_mydb these should be the connection details $database="space_4826174_mydb"; $mysql_user = "space_4826174"; $mysql_password = "omgtkkyb"; $mysql_host = "sql307.000space.com"; Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988044 Share on other sites More sharing options...
chopficaro Posted January 4, 2010 Author Share Posted January 4, 2010 wow ur fast, i edited the password like 3 seconds after posting it what in the world did u change? i copied ur connection info and pasted it over mine and it worked, but they looked the same! anyways thanks a bunch Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988052 Share on other sites More sharing options...
chopficaro Posted January 4, 2010 Author Share Posted January 4, 2010 they were the same... did u create the database in cpanel? maybe you creating the database in cpanel changed something anyways i can now establish a connection but i still cant create databases via php: Error creating database: Access denied for user 'space_4826174'@'%' to database 'space_4826174_mydb1' so i am willing to bet that the host is restricting me from making databases i suppose i can probably use the command INSERT and i can probably create tables, but im trying to learn php and make a text based browser game, so if this server is putting these sorts of restrictions on my website then who knows what else they've fucked with? im going to end up wasting a lot of time troubleshooting does anyone know of a free hosting service that doesn't place these sorts of restrictions on how mysql and php operate? Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988066 Share on other sites More sharing options...
Deoctor Posted January 4, 2010 Share Posted January 4, 2010 they were the same... did u create the database in cpanel? maybe you creating the database in cpanel changed something anyways i can now establish a connection but i still cant create databases via php: Error creating database: Access denied for user 'space_4826174'@'%' to database 'space_4826174_mydb1' so i am willing to bet that the host is restricting me from making databases i suppose i can probably use the command INSERT and i can probably create tables, but im trying to learn php and make a text based browser game, so if this server is putting these sorts of restrictions on my website then who knows what else they've fucked with? im going to end up wasting a lot of time troubleshooting does anyone know of a free hosting service that doesn't place these sorts of restrictions on how mysql and php operate? see the thing is that u need to create the database using the control panel only. u cannot create a database without the name of the user id (the format as i already mentioned <username of byethost>_<database name>),coz the mysql server being used is the same for most of the users, so to differentiate u need to have user name tagged to it.. try creating a database with the control panel before and then use, there is no alternate solution in byethost Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988068 Share on other sites More sharing options...
Deoctor Posted January 4, 2010 Share Posted January 4, 2010 if u want to have an alternate solution try the hosting with these http://www.free-webhosts.com/free-php-webhosting.php Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988069 Share on other sites More sharing options...
chopficaro Posted January 4, 2010 Author Share Posted January 4, 2010 thanks man ur the greatest, i was stuck on this problem for so long b4 i posted here ill give my current host another chance but if they cause me any more problems ill try ur link Quote Link to comment https://forums.phpfreaks.com/topic/187094-panelbyethostcom-mysql-question/#findComment-988165 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.