Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Our School Drupal site died after upgrade. MySQL is running but cannot connect to database. MyphpAdmin returns Error 2002.![Screenshot of MySQL activity.][1] Drupal 6.22 (after attempted upgrade) with MySQL 5.1.37 running on Apple Xserve 10.4.11. How can I reconnect to database and recover Drupal data?

driscollx:/usr/local/mysql root# mysqladmin status -u admin2 -p

Enter password: 
Uptime: 59788  Threads: 1  Questions: 3  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.0
driscollx:/usr/local/mysql root# mysqladmin version -u admin2 -p
Enter password: 
mysqladmin  Ver 8.41 Distrib 4.1.22, for apple-darwin8.0 on powerpc
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          5.1.37-log
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/mysql/mysql.sock
Uptime:                 16 hours 36 min 47 sec
Threads: 1  Questions: 4  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8 Queries per second avg: 0.0
driscollx:/usr/local/mysql root# 9-10settings.php
su: 9-10settings.php: command not found
driscollx:/usr/local/mysql root# mysqladmin version -h 127.0.0.1 -u admin2 -p
Enter password: 
mysqladmin  Ver 8.41 Distrib 4.1.22, for apple-darwin8.0 on powerpc
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          5.1.37-log
Protocol version        10
Connection              127.0.0.1 via TCP/IP
TCP port                3306
Uptime:                 16 hours 41 min 20 sec
Threads: 1  Questions: 5  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.0
driscollx:/usr/local/mysql root#
share|improve this question
    
Can you post the full text of the Error 2002 line? –  xofer Sep 9 '11 at 19:19
    
Can you access the Drupal DB using the same credentials used in your db_url in settings.php using the mysql commandline client? –  HTTP500 Sep 9 '11 at 19:24

1 Answer 1

Have you run update.php yet? If not, your database is unaffected; simply roll back the content of your DocumentRoot and you're back in business. If you did, then you might have a more-complex problem on your hands.

Assuming you ran update.php, or if you'd just prefer to actually update your site instead of doing a rollback, your best bet is probably to track down why the site can't connect to the database server. Given your described setup, I'd guess that PHP can't locate your MySQL socket file. There are some great ways to fix this, but in the interest of expediency, I'd recommend simply changing the @localhost portion of your $db_url in settings.php to read @127.0.0.1. This will force a connection over TCP instead of by socket. You can then leisurely track down whence your socket has wandered off.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.