Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
LinkBack Thread Tools
  #1  
Old 08-25-2007, 07:15 AM
Corporal
 
Join Date: May 2006
Location: Australia
Posts: 14
Question MySQL Host Address

I am trying to connect to mysql server through SQLyog to access the database created from CPanel. Yet I was required to enter MySQL host Address. I tried the 75.126.169.141 which is the FTP address of our vodahost server but it did not work. Can anyone tell me where I can find MySQL Host Address?

Many Thanks.

Ted
www.naturalstage.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 08-25-2007, 09:52 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: MySQL Host Address

Usually most programs that remotely connect to your database will use, as host, " www.yourdomain.com " . However, to be able to remotely connect, you will need to add your ISP's host to the list of allowed hosts. If you have a static IP address (i mean the one of your ISP) that's easy, but if you have a dynamically changing IP address, which changes each time you connect / disconnect fron the internet, that would be a problem.

Anyway, have a look at http://www.webyog.com/faq/content/16...at-an-isp.html
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 08-25-2007, 05:04 PM
Private First Class
 
Join Date: Jan 2007
Posts: 9
Default Re: MySQL Host Address

Hi,
I have the same problem.
I have been trying to connect a MYSQL database to my voda host cpannel.
what you just said sounds good but how would I get my ISP's host?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 08-25-2007, 05:06 PM
Private First Class
 
Join Date: Jan 2007
Posts: 9
Default Re: MySQL Host Address

I meant my voda host database
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 08-25-2007, 08:50 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: MySQL Host Address

Not sure what you mean. Your VH host, as i explained will simply be www.yourdomain.com . Your ISP's host (you will need it to add it to the list of allowed hosts) can be easily seen in http://www.ipchicken.com/ under Advanced, Name address.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 08-27-2007, 02:28 AM
Corporal
 
Join Date: May 2006
Location: Australia
Posts: 14
Default Re: MySQL Host Address

Thank you for the quick reply, Navaldesign. But I think what I want to find out is - I have created a mysql datase through CPanel which I believe is lcoated on my server and I like to modify the database. Where do I find out my MySql host address in order to make the connection? Thanks again.

www.naturalstage.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 08-27-2007, 02:37 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: MySQL Host Address

Ok, you are NOT looking for your host then, you want to reach your database to work with it. Go in your CP, MySQL section, and in the bottom of the page you will find a link to phpMyAdmin. Unless you have the latest Cpanel version with the new skin. In that case, go in your CP, and in the MySQL section there is a direct link to phpMyAdmin from Control Panel's home page.

In both cases, the link to phpMyAdmin will lead you to it, and you can manage your database from there.

If, instead of the above, you meant remote connection, my post above stands: VH doesn't have a specific address for the MySQL server, you simply give in your script your domain name.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old 08-28-2007, 08:04 AM
Corporal
 
Join Date: May 2006
Location: Australia
Posts: 14
Default Re: MySQL Host Address

I didn't know the existence of the link until you told me. Thank you very much. I think I have found what I needed.

www.naturalstage.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old 09-05-2007, 09:41 PM
Ram_Industries's Avatar
First Lieutenant
 
Join Date: Dec 2005
Location: Pittsburgh, Pa
Posts: 166
Send a message via Yahoo to Ram_Industries
Exclamation Re: MySQL Host Address

When following the forum I did as was suggested:
Used my domain name as the local host. I received the following error from the SQL.....

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";<?
// Replace the variable values below
// with your specific database information.
$host = "Martech-Inc.biz ";

When I used my localhost instead I received the following error....

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?
// Replace the variable values below
// with your specific database information.
$host = "c-**-*-***-**.hsd1.mn.comcast.net";<?
// Replace the variable values below
// with your specific database information.
$host = "c-**-*-***-**.hsd1.mn.comcast.net";<?
// Replace the variable values below
// with your specific database information.
$host = "c-**-*-***-**.hsd1.mn.comcast.net";<?
// Replace the variable values below
// with your specific database information.
$host = "c-**-*-*-**.hsd1.mn.comcast.net";<?
// Replace the variable values below
// with your specific database information.
$host = "c-**-*-***-**.hsd1.mn.comcast.net";<?
// Replace the variable values below
// with your specific database information.
$host = "c-**-*-***-**.hsd1.mn.comcast.net";

Neither of the above worked in setting up the file to the dbConfig.php !!!

What am I doing wrong?

Ram_Industries
Robert Montgomery
http://Martech-Inc.biz
__________________
Ram_Industries
Robert A. Montgomery
Ram-Industries@comcast.net
http://Martech-Inc.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old 09-05-2007, 10:09 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: MySQL Host Address

How are you trying to connect to the MySQL server ? through a desktop or a server installed application ?
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old 09-06-2007, 02:29 AM
Ram_Industries's Avatar
First Lieutenant
 
Join Date: Dec 2005
Location: Pittsburgh, Pa
Posts: 166
Send a message via Yahoo to Ram_Industries
Question Re: MySQL Host Address

Thru desktop into the cPanel .......

I logged into the cPanel and clicked on the mySQL icon then went into the db from the next page or there abouts.

Ram_Industries
Robert Montgomery
http://Martech-Inc.biz
__________________
Ram_Industries
Robert A. Montgomery
Ram-Industries@comcast.net
http://Martech-Inc.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old 09-06-2007, 02:31 AM
Ram_Industries's Avatar
First Lieutenant
 
Join Date: Dec 2005
Location: Pittsburgh, Pa
Posts: 166
Send a message via Yahoo to Ram_Industries
Default Re: MySQL Host Address

I also watched the tutorial in regards to working in the myPHPadmin page but still could not get this to work.

Quote:
Originally Posted by Ram_Industries View Post
Thru desktop into the cPanel .......

I logged into the cPanel and clicked on the mySQL icon then went into the db from the next page or there abouts.

Ram_Industries
Robert Montgomery
http://Martech-Inc.biz
__________________
Ram_Industries
Robert A. Montgomery
Ram-Industries@comcast.net
http://Martech-Inc.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old 09-06-2007, 02:57 AM
Ram_Industries's Avatar
First Lieutenant
 
Join Date: Dec 2005
Location: Pittsburgh, Pa
Posts: 166
Send a message via Yahoo to Ram_Industries
Question Re: MySQL Host Address

In addition this is the type of code I started working with.

<?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "UserName";
$pass = "Password";
$db = "dbName";

// This part sets up the connection to the
// database (so you don't need to reopen the connection
// again on the same page).
$ms = mysql_pconnect($host, $user, $pass);
if ( !$ms )
{
echo "Error connecting to database.\n";
}

// Then you need to make sure the database you want
// is selected.
mysql_select_db($db);

What part of the program am I missing?

I believe I will again have this issue when I set the code for the Registration page as well, since I am supposed to create a file with the code ...... But would I create the file in the root-dir or from someplace else?

Ram_Industries
Robert Montgomery
http://Martech-Inc.biz
__________________
Ram_Industries
Robert A. Montgomery
Ram-Industries@comcast.net
http://Martech-Inc.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old 09-06-2007, 09:42 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: MySQL Host Address

Ok, the answer to my question is that you are connecting to the database through a php script installed on the server.
Since what you are trying to do is installation of this script, the steps to follow are:

1. Create a database in your CP. CP > MySQL Databases > Add New Database (type the name you want your database to have). Please note that the name that CP creates for the database is NOT what you have typed, but cpusername_dbname where dbname is what you have called your database, and cpusername your own CP username. They are separated by an underscore.
2. In the same page, create a user for this database, let's suppose that you have called the user robert and you have provided, as password, ABCrobert . Please note that CP creates a user, but it names the user cpusername_robert. (as for the database name)
3. ADD this user to the specific database, or he has no access. This is done through the Add user to database dropdowns (one for users, one for DBs, select user and satabase and press ADD USER).

4. Now, find the file in your script that contains the database connection details. Since the script runs on your server, you have the follwing details:
Host = localhost
User = cpusername_robert
Password = ABCrobert
DB name = whatever you have called your database

Once you have changed this file, in your computer, upload the edited file in the corresponding folder of your site.

At this point, your script should have another part which is also necessary for it to work, and this is the installation wizard, if it exists.

If it exists (usually it should be a file called "install.php , or setup.php or something similar) by typing in your browser http://www.yourdomain.com/scriptfolder/install.php the script should automatically create in the database all necessary tables. If this is a serious script, it should also ask you, before creating the tables, the desired username and password (necessary for Administrator login). It will also, if necessary, populate some of the tables with some default values, and at the end, it will give you a succesful installation message.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15  
Old 09-06-2007, 03:13 PM
Ram_Industries's Avatar
First Lieutenant
 
Join Date: Dec 2005
Location: Pittsburgh, Pa
Posts: 166
Send a message via Yahoo to Ram_Industries
Question Re: MySQL Host Address

Naval:

When I tried to do as you said, I got the following error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$dbh=mysql_connect ("localhost", "wgnfqog_RamIndus", "This is where I typed my password") or die ('I ca' at line 1

Ram_Industries
Robert Montgomery
http://Martech-Inc.biz
__________________
Ram_Industries
Robert A. Montgomery
Ram-Industries@comcast.net
http://Martech-Inc.biz
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16  
Old 09-06-2007, 04:08 PM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 9,346
Default Re: MySQL Host Address

Can you please post here this part of your script ? Including the lines before and after the query
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17  
Old 09-06-2007, 07:40 PM
Ram_Industries's Avatar
First Lieutenant
 
Join Date: Dec 2005
Location: Pittsburgh, Pa
Posts: 166
Send a message via Yahoo to Ram_Industries
Question Re: MySQL Host Address

Naval:

Below is what is listed in my site

inside the dbConfig.php is the following:

<?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "*********"; hid username for this purpose
$pass = "********"; hid password for this purpose
$db = "******_dbConfigphp"; hid first section for this purpose
// This part sets up the connection to the
// database (so you don't need to reopen the connection
// again on the same page).
$ms = mysql_pconnect($host, $user, $pass);
if ( !$ms )
{
echo "Error connecting to database.\n";
}
// Then you need to make sure the database you want
// is selected.
mysql_select_db($db);
?>
<?php
// dbConfig.php is a file that contains your
// database connection information. This
// tutorial assumes a connection is made from
// this existing file.
include ("dbConfig.php");

//Input vaildation and the dbase code
if ( $_GET["op"] == "reg" )
{
$bInputFlag = false;
foreach ( $_POST as $field )
{
if ($field == "")
{
$bInputFlag = false;
}
else
{
$bInputFlag = true;
}
}
// If we had problems with the input, exit with error
if ($bInputFlag == false)
{
die( "Problem with your registration info. "
."Please go back and try again.");
}
// Fields are clear, add user to database
// Setup query
$q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
."VALUES ('".$_POST["username"]."', "
."PASSWORD('".$_POST["password"]."'), "
."'".$_POST["email"]."')";
// Run query
$r = mysql_query($q);

// Make sure query inserted user successfully
if ( !mysql_insert_id() )
{
die("Error: User not added to database.");
}
else
{
// Redirect to thank you page.
Header("Location: register.php?op=thanks");
}
} // end if

//The thank you page
elseif ( $_GET["op"] == "thanks" )
{
echo "<h2>Thanks for registering!</h2>";
}

//The web form for input ability
else
{
echo "<form action=\"?op=reg\" method=\"POST\">\n";
echo "Username: <input name=\"username\" MAXLENGTH=\"16\"><br />\n";
echo "Password: <input type=\"password\" name=\"password\" MAXLENGTH=\"16\"><br />\n";
echo "Email Address: <input name=\"email\" MAXLENGTH=\"25\"><br />\n";
echo "<input type=\"submit\">\n";
echo "</form>\n";
}
// EOF
?>
<?php
session_start();
// dBase file
include "dbConfig.php";
if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}

// Create query
$q = "SELECT * FROM `dbUsers` "
."WHERE `username`='".$_POST["username"]."' "
."AND `password`=PASSWORD('".$_POST["password"]."') "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["valid_id"] = $obj->id;
$_SESSION["valid_user"] = $_POST["username"];
$_SESSION["valid_time"] = time();
// Redirect to member page
Header("Location: members.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.");
}
}
else
{
//If all went right the Web form appears and users can log in
echo "<form action=\"?op=login\" method=\"POST\">";
echo "Username: <input name=\"username\" size=\"15\"><br />";
echo "Password: <input type=\"password\" name=\"password\" size=\"8\"><br />";
echo "<input type=\"submit\" value=\&