chopficaro
01-04-2010, 07:02 AM
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?
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?