Hi ,
i get this error :
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
.
PHP Code:
$con=mysql_connect() or die("Problem".mysql_error());
print "Successfully connected.\n";
mysql_close($con);
The weird thing is that i can connect to mysql in my java programs etc.
Quote:
mysqladmin status
Uptime: 1791 Threads: 1 Questions: 5 Slow queries: 0 Opens: 6 Flush tables: 1 Open tables: 0 Queries per second avg: 0.003
|
also,
Quote:
mysqladmin ping
mysqld is alive
|
So, i am guessing i have to edit something to get it working.
ps i am running Slackware 9.0 , default mysql installation.
the phpinfo(); gives this:
Quote:
Active Persistent Links 0
Active Links 0
Client API version 3.23.49
MYSQL_MODULE_TYPE builtin
MYSQL_SOCKET /tmp/mysql.sock <----
MYSQL_INCLUDE no value
MYSQL_LIBS no value
|
i have edited the php.ini and i have the following:
Quote:
[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 =/var/run/mysql/mysql.sock
; 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 =
|
Do i have to edit anyting else ?
Any help would be appreciated.