Jump to content

panel.byethost.com mysql question


chopficaro

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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";

   

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 :P

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.