简体   繁体   中英

mysql_connect() on localhost

I am trying to implement a little 'intranet' on my home network, but I am an apache/mysql configuration noob...

Running fedora 10, and have apache, mysql, and php set up as well as i know how. However, when I try using a standard form with POST, the php script seems to error out on the mysql_connect(...); line. I don't get an error message, in fact the browser page is blank, even in the view source window. Here is what I have:

$conn = mysql_connect("localhost:1186", "user", "password");

...

I have added the username and password in the mysqladmin tool, and i've tried "localhost" and "localhost:1186", as I saw the 1186 port referenced in my my.cnf file.

Obviously I have something configured wrong, any ideas?

The resulting page is blank when there's an error. One of the more common errors to make in your setup is to forget to install either the php-mysql or mysql-server packages. Verify that they're installed, and if not install either or both and then restart the httpd service, and start the mysql service if not running.

the default for a fresh mysql install would be

$conn = mysql_connect("localhost:3306", "root", "");

or just

$conn = mysql_connect("localhost", "root", "");

This is good for testing purposes but leaving the root account unprotected is a bad habit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM