Current User: Guest Login Register
Please consider registering


Register? | Lost Your Password?

Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

MySQL socket connection issue

Reply to Post Add a New Topic
UserPost

5:26 am
October 8, 2010


simonhoh

New Member

posts 1

Hi,

 

I've been following the guide on "Handling Multiple Domains with Postfix Admin in RHEL/CentOS5" but got stuck at step 3 of configuring Postfix.

 

When I executed the command "postmap -q localhost mysql:/etc/postfix/mysql-domains.cf", it gave me the following:

postmap: warning: connect to mysql server localhost: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

 

I read on some site that postfix runs chrooted so I need to create hardlinks for it to be able to reach mysql.sock, so I added the following in /etc/my.cnf in 'start':


if [ -e /var/lib/mysql/mysql.sock ]; then

  if [ -e /var/spool/postfix/var/lib/mysql/mysql.sock ]; then

    rm /var/spool/postfix/var/lib/mysql/mysql.sock

  fi

  mkdir -p /var/spool/postfix/var/lib/mysql

  chown mysql /var/spool/postfix/var/lib/mysql

  ln /var/lib/mysql/mysql.sock /var/spool/postfix/var/lib/mysql/mysql.sock

fi

 

I'm assuming that this will create the hardlink required everytime I restart mysqld. Problem is, it is still giving me the "Can't connect to local MySQL server through socket" warning.

 


I've been searching for a solution for days now but no luck. Hope someone can shed some light on the problem I'm facing. By th way, I havent configured anything of postfix except adding the mysql-domains.cf file as instructed in the guide.

4:26 am
October 9, 2010


shanmugasundaram s

Member

posts 46

hi simonhoh,

         To avoid this connection problem,follow the steps below to connect to mysql database.

1. cd /var/lib/mysql/

2. touch mysql.sock

3. chown mysql.mysql mysql.sock

4.chmod 777 mysql.sock

5.cd /tmp

6. ln -s /var/lib/mysql/mysql.sock mysql.sock

7. service mysqld start


8:19 am
October 9, 2010


consultant

Admin

posts 353

Post edited 8:21 am – October 9, 2010 by consultant


Hi simonhoh,

 

No, Postfix does not run chrooted unless you specifically configured it to be so which is a complicated undertaking.

 

Are you sure mysql is running, you can verify it by typing mysql in the command line. If it is not running, you will get the same error as postmap.

Reply to Post

Reply to Topic:
MySQL socket connection issue

Guest Name (Required):

Guest Email (Required):

Smileys
Confused Cool Cry Embarassed Frown Kiss Laugh Smile Surprised Wink Yell
Post New Reply

Guest URL (required)

Math Required!
What is the sum of:
1 + 12
   


About the Linux Mail Server Setup and Howto Guide Forum

Forum Timezone: America/New_York

Most Users Ever Online: 60

Currently Online:
25 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 2
Forums: 5
Topics: 343
Posts: 1062

Membership:

There are 966 Members
There have been 91 Guests

There is 1 Admin

Top Posters:

shanmugasundaram s – 46
Kendermin – 15
Ginger – 14
bighorn – 14
iron_michael86 – 12
Raminda – 11

Recent New Members: waveney, achal, niesul14, hesaum, sreevinodss, nasonov

Administrators: consultant (353 Posts)