MandrivaThis Forum is for the discussion of Mandriva (Mandrake) Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've just installed a binary version of mysql 4.0 downloaded from mysql.com. Installation went ok and I can connect to the database.
But my dbconnect isn't working.
error printed to PHP page reads.
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/emailer/dbconnect.php on line 3
I cannot connect to the database because: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The password and username are ok and I can connect using a terminal. I've tried rebooting but no joy.
Is this something to do with configuring PHP as I used a binary distribution and not an RPM? If so what change do I have to make. Or where can I read up some more.
Here's my dbconnect
$db=mysql_connect ("localhost", "usrnme", "psswd") or die ('I cannot connect to the database because: ' . mysql_error());
I've just installed a binary version of mysql 4.0 downloaded from mysql.com. Installation went ok and I can connect to the database.
But my dbconnect isn't working.
error printed to PHP page reads.
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /var/www/html/emailer/dbconnect.php on line 3
I cannot connect to the database because: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
The password and username are ok and I can connect using a terminal. I've tried rebooting but no joy.
Is this something to do with configuring PHP as I used a binary distribution and not an RPM? If so what change do I have to make. Or where can I read up some more.
Here's my dbconnect
$db=mysql_connect ("localhost", "usrnme", "psswd") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("dbase",$db);
Cheers
Looks like your server isn't running!! Dis you stop yur old server before installing the new one??
What happens when you do a "telnet localhost 3306".
$ ps -ef |grep mysql
Kill all of them and then start mysql using "service mysql start" (on redhat)
Thanks for your help guys. By checking this stuff I have increased my understanding alot but have come to the end of things I can check but still cant get php to connect to mysql.
I've included the results of your suggestions below.
[root@localhost /]# ./usr/local/mysql-standard-4.0.20-pc-linux-i686/bin/mysqladmin -u root -ppsswrd version
./usr/local/mysql-standard-4.0.20-pc-linux-i686/bin/mysqladmin Ver 8.40 Distrib 4.0.20, for pc-linux on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 4.0.20-standard
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 18 min 21 sec
Threads: 1 Questions: 1 Slow queries: 0 Opens: 6 Flush tables: 1 Open tables: 0 Queries per second avg: 0.001
[root@localhost /]#
I tried
include_path = "./usr/lib/php/:/usr/share/pear/" (without the first colon)
and
include_path = "./"
As php is working OK I didn't think it was this include path so put it back to normal but cant see another include_path in php.ini
Here is the mysql section of php.ini
\\\\\\\\
start
////////
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On
; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1
; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = -1
; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
mysql.default_port =
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =
; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =
; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =
; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =
; Maximum time (in secondes) for connect timeout. -1 means no limimt
mysql.connect_timeout = 60
; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Erros will be displayed.
mysql.trace_mode = Off
\\\\\\\\
end
////////
I tried adding /tmp/mysql.sock to
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock
but no joy.
Mysql passwords definatly work in a terminal and there isn't a typo in the dbconnect file.
Here's the mysql relevant bit from phpinfo().
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 4.0.18
MYSQL_MODULE_TYPE none
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE no value
MYSQL_LIBS no value
MYSQL_SOCKET still doesn't read /tmp/mysql.sock even after change php.ini default socket name.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.