mysql test page failed!!! im running slackware 10
nid some help!!!
im running a slackware 10.0 with apache 1.3, php 4.3 and mysql 4.0. i got this error when i tried to test a simple php script and mysql: <html> <title> can u see this! </title> <body> <?php $conn = mysql_connect("localhost", "root", "xxx"); $create_success = mysql_create_db("testdbx"); if($create_success) echo("<b><font color=\"blue\">create database: success!</font></b><br>"); mysql_select_db("testdbx",$conn); $sql = "CREATE TABLE testTable (id int not null primary key auto_increment, testField varchar (75))"; $result = mysql_query($sql, $conn) or die(mysql_error()); echo $result; mysql_close(); ?> </body> </html> my apache error logs: [Sat Mar 19 13:47:16 2005] [error] PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) in /var/www/htdocs/t.php on line 6 [Sat Mar 19 13:47:16 2005] [error] PHP Fatal error: Call to undefined function: mysql_create_db() in /var/www/htdocs/t.php on line 8 [Sat Mar 19 13:48:17 2005] [error] PHP Fatal error: Call to undefined function: mysql_create_db() in /var/www/htdocs/t.php on line 8 [Sat Mar 19 13:49:11 2005] [error] PHP Fatal error: Call to undefined function: mysql_create_db() in /var/www/htdocs/t.php on line 8 but using: mysql -u root -p >my password mysql> mysql> use mysql Database changed mysql> show tables; +-----------------+ | Tables_in_mysql | +-----------------+ | columns_priv | | db | | func | | host | | tables_priv | | user | +-----------------+ 6 rows in set (0.00 sec) mysql> wats wrong? any help wud be appreciated, tenks!!! |
Your php build doesn't have mysql support. Grab php-mysql package for your distro.
|
CARTMAN: That's not true, the function is declared so it's built with MySQL support.
Juker: Check the /etc/my.cnf file (or whereever you've your config file) and see if you have something like Code:
[mysqld] Code:
skip-networking Oh by the way, try making another user, root has too many permissions ;) |
thanks gbonvehi, my problem is stil there, anymore suggestion?
|
I'm not trying to offend you, but if /var/run/mysql/mysql.sock exists. (Many people get offend with this kind of questions but sometimes it happens ;) )
|
its ok.
if im working from the console, mysql is fine. wats the problem, the mysql.sock is also there! gbonvehi, after installing mysql is there any configuration i need to do in order for mysql to work with php? or do u know some links (tutorial) for this? |
There are plenty of tuturials and A&Q (here in LQ), do this, create a file, let's say: test.php and put inside:
Code:
<? çç |
All times are GMT -5. The time now is 11:05 PM. |