Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

here the mail.log

server localhost: Can't connect to local MySQL server through socket '/var/run/mysqld
/mysqld.sock' (2)
    Mar 23 23:07:19 ubuntu postfix/trivial-rewrite[6417]: fatal: mysql:/etc/postfix/,lock|fold_fix): table lookup problem
    Mar 23 23:07:20 ubuntu postfix/smtpd[6401]: warning: problem talking to service rewrite: Success
    Mar 23 23:07:20 ubuntu postfix/cleanup[6296]: warning: problem talking to service rewrite: Connection reset by peer
    Mar 23 23:07:20 ubuntu postfix/master[6291]: warning: process /usr/lib/postfix/trivial-rewrite pid 6417 exit status 1
    Mar 23 23:07:20 ubuntu postfix/master[6291]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling

netstat -l|grep mysql

tcp        0      0 localhost:mysql         *:*                     LISTEN     
unix  2      [ ACC ]     STREAM     LISTENING     10671    /var/run/mysqld/mysqld.sock

and i can connect through this

mysql -u postfix -h -p postfix
share|improve this question

closed as off-topic by Ward, kasperd, masegaloeh, 84104, Hyppy Apr 19 '15 at 17:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Was it ever working before? If so what changed since? What have you tried so far to fix it? – Yanick Girouard Mar 23 '12 at 21:21
no i couldnt make it work – samer na Mar 23 '12 at 21:23
Then ask a local consultant/administrator. – mailq Mar 23 '12 at 21:46

Start your local MySQL server.

share|improve this answer
thanx for reply but can u explain more – samer na Mar 23 '12 at 21:21
No. You didn't explain either. – mailq Mar 23 '12 at 21:22
Run sudo /sbin/service mysqld start and tell us what it says... – Yanick Girouard Mar 23 '12 at 21:25
root@ubuntu:~# sudo /sbin/service mysqld start sudo: /sbin/service: command not found – samer na Mar 23 '12 at 21:27
Run sudo /usr/sbin/service mysqld start and tell us what it says. – mailq Mar 23 '12 at 21:47

MySQL usually has two ways to connect to it: the Unix socket and an IP address.

In the error message above, Postfix is using the socket and your testing is using the IP address.

Check that the socket exists and is where Postfix thinks it is (/var/run/mysqld/mysqld.sock).

Also check that the username and password that Postfix is using work for you through the socket. MySQL permissions care about username, password and the source of the connection. Just because you can connect from one IP address doesn't mean you can from another. This means that with the same username, you can have a different password and permissions if you connect from a different place. This also includes connecting via the Unix socket. Make sure your testing is done the same way Postfix connects.

share|improve this answer

what is your os version and mysql version? depending on what they are, you can use something like /etc/init.d/mysql (could be mysqld in some versions) status to find out if it is running in ubuntu.

then you can use locate mysqld.sock to find out if the socket file is actually in the location postfix user is trying to use.

share|improve this answer
im working on Ubuntu 11.10 and mysql is 5.1 – samer na Mar 24 '12 at 5:32

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