ID:184010
 
I've been working on this for days now. I have mySQL server and an FTP (website) and the PHP code for it ... NOTHING WILL WORK to make them connect .... i've tried my site name, my ip, localhost, local host with the default after it .....

<?php
$con = mysql_connect(" ???? ","root","MY PASS HERE");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
?>


This is my code and I CANT MAKE IT WORK! the "?????" should be localhost or something but no matter what it is i get the "you couldnt connect" error. I think my name is root and i know wat my pass is. Any1 no how to do this ?? plz help!
Depending on your version of MySQL, you may need to enable the antiquated "old_password" authentication scheme. I have had to do so for a number of PHP/MySQL apps I've written.

Are you doing this on your own personal dev machine, or on a production server? Are you on Windows or on Linux? Are you using Appache? Are you fairly positive that MySQL is configured correctly?
In response to PirateHead
PirateHead wrote:
Are you doing this on your own personal dev machine, or on a production server? Are you on Windows or on Linux? Are you using Appache? Are you fairly positive that MySQL is configured correctly?

my own maching, on my FTP. Windows. No Appache. I installed mySQL straight from the site and followed the installer (pretty much I clicked next when it told me to), but i'm not sure if that means its right
In response to Devin148
So you're saying that the web server (+ PHP) are on a remote machine, and you've installed MySQL locally? That's not going to work, unless you want to host MySQL 24/7 (hint: you don't want to do that).

Most web hosts that offer PHP also offer MySQL. If they don't, get a new web host!
In response to Crispy
Crispy wrote:
Most web hosts that offer PHP also offer MySQL. If they don't, get a new web host!

I have seen ones that actually only host MySQL if you pay a fee.
In response to Shlaklava
Like I said: If you have one of those hosts, get a new one. MySQL is not hard for web hosts to install and maintain, and it's free. If you're providing PHP, there's no excuse for not providing MySQL.
In response to Crispy
PHP isn't anything without a database if someone is providing JUST PHP find yourself a new host..
In response to Crispy
hey does anyone know if GoDaddy provides that cause thats what I got. It had PHP and everything else, but I am kinda dumb wen it comes to technology. If GoDaddy doesn't ... anyone know one that does (not that It will help cuase I am signed up until 2011 :P )
In response to Devin148
GoDaddy hosting. Eek. I've heard nothing but bad things about their hosting service (though their domain name registration service is apparently OK).

From the look of this page, they do provide MySQL; their cheapest plan allows you up to 10 MySQL databases, which is plenty. Go ask them how to set it up... they may have a FAQ somewhere that answers this question, since it has to be fairly common.
In response to Crispy
their customer service blows.. and their tools are not intuitive, and their instructions are laughable...

But they're cheap and they work ok^_^

Once your in your web hosting panel, go to "MySQL" then click "Create New Database", once it's active, click on the little computer icon that says "View Connection Strings", it will give you the server location as well as some basic settings
In response to Crispy
Crispy wrote:
GoDaddy hosting. Eek. I've heard nothing but bad things about their hosting service (though their domain name registration service is apparently OK).


Nope, even their domain registration service is a load of crap. GoDaddy does not stand up for its clients -- just ask the owner of SecLists.org, whose entire site consisting of over 200000 pages was pulled without warning or notification at the request of MySpace's lawyers.

Read the story here and other places: http://www.politechbot.com/2007/01/26/godaddy-pull-plug/

Just stay as far away from GoDaddy as possible.