SRL Archive - Web Development

MySQL connection error?


Abyssal

2007-05-24 22:17:14

Today I setup MySQL, Apache and PHP on my computer.

Yes, PHP and apache are installed correctly they work <3

But, on my command prompt i type

C:\mysql\bin\mysql
And it gives an invalid pass error, so I do this:

C:\mysql\bin\mysql -u root
And it works. Why?

~~

Also, heres my PHP file:
[php]
<html>
<head> <title>MySQL Connection Test</title> </head>
<body>
<h2>

<?php
$connection = mysql_connect("localhost", "root", "")
or die("Unable to connect.");
echo("Congratulations! Connected to MySQL!");
?>

</h2>
</body>
</html>
[/php]

And nothing happens! It's like it fails at the php part. Doesn't 'die' or anything… Why?!

Night

2007-05-27 13:12:11

I think apache needs to be configed with mysql… you should google (OS)amp packages to install, they will correctly install the stuff for you…

for windows, my favorite is xampp (google it)

i3each

2007-06-02 12:26:15

hmm, try doing a test to make sure php's enabled to start with, and from this you should be able to find whether MySQL's installed properly.

[PHP]<? php_info(); ?>[/PHP]
That should bring up a list of it's components and stuff, if that's the function.
Haven't really used it much, so if it's the wrong command, sorry :\

but if all else fails, http://wampserver.com

Dankness

2007-06-02 17:42:33

if your on a windows box i suggest Xaamp Apahe and Friend LAMP build. It will autoamticly set you up w/ apache/mysql/php and ftp servers that are 1 clck install and 1 click remove. Dont waste your time tryin to sort out how to setup apache,php,mysql,etc unless you require this knowledge for server maintaince repairs (mainly as setupin windows is different then in linux so therefore its a waste of time that should be spend developing your apps)

–Dankness

stryfedll

2007-06-04 11:51:34

first, install MySQL as a service by going to Start > Run "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld" –install

Then in PHP.ini set uncomment php_mysql.php so that it uses the MySQL extension, since PHP5 MySQL isn't installed as an extension by default, it must be manually enabled. Make sure that…

extension_dir = C:/pathtophp/ext (if using php5 extensions are in the ext directory, the extension directory must be set manually)

stryfedll

2007-06-04 11:57:13

Applications like WAMP are nice but if you want to learn how to do it yourself it will take some time but its well worth it. Everything you need to know is in the MySQL/PHP manuals for installing them. It took me about 8 hours the first time I manually installed Apache/PHP/MySQL. But, you will gain a lot of indepth knowledge of how to configure a web server.

WinterDream

2007-06-07 00:52:07

From: stryfedll
Applications like WAMP are nice but if you want to learn how to do it yourself it will take some time but its well worth it. Everything you need to know is in the MySQL/PHP manuals for installing them. It took me about 8 hours the first time I manually installed Apache/PHP/MySQL. But, you will gain a lot of indepth knowledge of how to configure a web server.


Yeh i use WAMP my self to its easy to use and it saves alot of time
XAMPP is also a good package < (Mail server and FTP server included)