Forum Moderators: mack

Message Too Old, No Replies

Cant get mysql database to select?

can run locally - not on server?

         

operafan

7:06 am on Dec 18, 2003 (gmt 0)

10+ Year Member



Hi I'm new to databases, I can get my program working locally on apache/mysql.
But when I upload to the server into a subfolder I cant - I get cant connect to database.
I've installed mysql. I've checked the codes I dont know if the "localhost" connection is the problem - I've checked the filename connection is right.

Pls advise.

willybfriendly

7:11 am on Dec 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check with your host. Depending on the way the server is set up, "localhost" may or may not work as the host name for connecting to MySQL.

WBF

operafan

7:41 am on Dec 19, 2003 (gmt 0)

10+ Year Member



I've checked it's used as localhost. But my question is, the myd's & myi's file - do I need to install it into the mysql folder - i dont cant find it though.
Locally on windoz it's in mysql/data/testdatabase/

Advise please, me host still havent get back to me on that.

mack

5:54 am on Dec 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Localhost might not "technicaly" work.

When they say it is localhost it will be from that specific machine. I have knows isp's to move the db onto another machine try using an ip address instead of localhost. It just might work.

For example on my hosting account I have a different ip for my site and my db, but still part of the one account.

Mack.

operafan

9:39 am on Dec 22, 2003 (gmt 0)

10+ Year Member



Sorry if I posted my question with not clear enough, so this is how it works on my local machine:

I installed phpdev-it;s a all in 1 package - apache,mysql,php.

I've served up the php pages in the www folder which acts as the webpages folder.
While I've placed the mysql data files( myi & myd ) into the mysql folder. the path usually - mysql/data/folder-containing-thedatabase

On the local machine it works flawlessly.

I've asked my host provider & they say using localhost is correct.
I have this connect code $objconnect=mysql_connect ( "localhost", "databasefolder" ,"")
without the password.

So my understanding is if I place the data files into the correct mysql folder on the server, the php files will connect to it.

While I see my host tutorials says that you need to set the password & all that crap?

Do I also have to change the php.ini variables - the global variables ?

Gundamknight

6:29 pm on Dec 22, 2003 (gmt 0)

10+ Year Member



Most MySQL databases I've worked with require:
- Host name or IP
- Username
- Password
- Database Name (optional)

Which would give you:

$connobj = mysql_connect("hostname", "username", "password")

...or something similar

Each server is configured differently. Check through your account documentation again, or contact tech support there to see if they can talk you through it.