Page 1 of 1
'Can't connect to local MySQL server' mesage.
Posted: Wed Oct 29, 2003 7:04 am
by tweet
redhat9.0 used.
mysql4.0.15a.tar.gz installed............
mysql-server running.....
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /data/guestbook/guestbook.php on line 7
Unable to select database
what's problem?
Posted: Wed Oct 29, 2003 7:45 am
by Stoker
is the mysql server daemon running?
ps -axw | grep mysqld
..............
Posted: Wed Oct 29, 2003 8:14 am
by tweet
mysql server automatically start at boot-time
added /bin/sh -c 'cd /usr/local/mysql/bin/mysqld_safe --user=mysql &'
in /etc/init.d/rc.local file
[root@localhost root]# ps -axw | grep mysqld
725 ? S 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/localhost.localdomain.pid
759 ? S 0:00 [mysqld]
1177 pts/1 S 0:00 grep mysqld
Posted: Wed Oct 29, 2003 8:27 am
by Stoker
Can you connect with the mysql cli utility?
mysql -u username -p databasename
What is the permissions of /tmp ?
.........
Posted: Wed Oct 29, 2003 8:55 am
by tweet
document root "/data' changed in httpd.conif...
run in /data directory when run php
when install php , dso module way installed.
$localhostname = "localhost"; // Point this to where the MySQL server is listenting.
$username = "root"; // MySQL username
$password = ""; // MySQL password
$database = "guestbook"; // The database you wish to use for hpMyGuestBook.php
can't connect mysql client.
[root@localhost guestbook]# mysql -u root guestbook
bash: mysql: command not found
tmp permission.
drwxrwxrwt 21 root root 2048 tmp
but, strange point, mysql.sock file haven't in /tmp.
mysql.sock file haven't on entire system.
Posted: Wed Oct 29, 2003 9:09 am
by Stoker
the socket file is created by the client library, so tmp must be world writeable, which yours seem to be..
if you dont have the mysql cli client that may indicate that you do not have the mysql client libraries installed... perhaps some rpm package for that?
try find the mysql cli binary first, see if it is executable:
find / -name mysql -exec ls -l {} \;