PDA

View Full Version : PHP mysql_connect to database


man_im_bored
08-20-03, 01:19
Umm, yeah, whats wrong with this?
$link = mysql_connect("localhost", "", "")
or die("Could not connect stupid!: " . mysql_error());

I don't have a username or password so....?!??!! What do I do?
Anyone know. I'm testing this on my own computer (obviously).....and it comes up with

"Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in "

man_im_bored
08-20-03, 01:21
Forgot to mention, I'm new at php.

iamien
08-20-03, 01:50
I think you have a user/pass because that looks like valid code. you sure you have PHP running on this machien <ignroe that if you do :P>

man_im_bored
08-20-03, 01:59
php.ini stuff is all good, it has

mysql.default_user =
mysql.default_host =
mysql.default_password =

:S

So its not that php.ini file

man_im_bored
08-20-03, 02:01
No, I definatly have php on my machine

Vlad902
08-20-03, 02:02
Are you sure MySQL itself is running, sounds like it's not since it has nto bind to a port...

Vlad902
08-20-03, 02:03
Originally posted by man_im_bored
No, I definatly have php on my machine

MySQL is not PHP, MySQL is a Database, PHP is a web programming language...

man_im_bored
08-20-03, 02:03
If I have a username/password.... I dunno what it is...:S

iamien
08-20-03, 02:04
uGG that what i ment :P you couldn't get that error without PHP install :D made myself look liek a retard. anyway yes it sounds like you need to have MySQL running Vlad is as always correct or at least close to it :p

Vlad902
08-20-03, 02:06
No, always correct ;)

man_im_bored
08-20-03, 02:08
running just fine (MYSQLSERVER)

iamien
08-20-03, 03:03
Well you gotten set up an account within in

Philipp
08-20-03, 03:28
Change it to: mysql_connect("localhost", "root", "")

man_im_bored
08-22-03, 06:41
its all good....thanks anyway.