eximstats db own set of mysql connection settings ? can't connect to local

eva2000

Well-Known Member
Aug 14, 2001
339
16
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
I change mysql datadir on my latest fresh installed cpanel server from /var/lib/mysql to /home/mysql and everything works database wise except whm -> mail functions

i.e. view sent summary etc when ran, will give error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

error log shows

Starting tailwatchd: DBI connect('eximstats:localhost','eximstats',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/local/cpanel/Cpanel/TailWatch/Eximstats.pm line 862.
mysql process shows

ps a | grep mysql

Code:
 8049 pts/0    S      0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/home/mysql --pid-file=/home/mysql/mydomain.com.pid
 9157 pts/0    S<l    0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/home/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/home/mysql/mydomain.com.err --open-files-limit=16384 --pid-file=/home/mysql/mydomain.com.pid --socket=/home/mysql/mysql.sock
/home/mysql

Code:
ls -alh /home/mysql
drwxr-x--x  16 mysql mysql 4.0K Sep 16 17:20 ./
drwx--x--x. 11 root  root  4.0K Sep 16 17:21 ../
drwx------   2 mysql mysql 4.0K Sep 16 01:35 cphulkd/
-rw-rw----   1 mysql mysql  43K Sep 16 17:20 mydomain.com.err
-rw-rw----   1 mysql mysql    5 Sep 16 17:20 mydomain.com.pid
drwx------   2 mysql mysql 4.0K Sep 16 17:24 eximstats/
drwx------   2 mysql mysql 4.0K Sep 16 01:35 horde/
-rw-rw----   1 mysql mysql  18M Sep 16 17:20 ibdata1
-rw-rw----   1 mysql mysql 512M Sep 16 17:20 ib_logfile0
-rw-rw----   1 mysql mysql 512M Sep 16 04:50 ib_logfile1
drwx------   2 mysql mysql 4.0K Sep 16 00:24 leechprotect/
drwx------   2 mysql mysql 4.0K Sep 16 01:35 logaholicDB_dbd/
drwx--x--x   2 mysql mysql 4.0K Sep 16 01:35 mysql/
srwxrwxrwx   1 mysql mysql    0 Sep 16 17:20 mysql.sock=
-rw-r--r--   1 mysql mysql    6 Sep 16 00:15 mysql_upgrade_info
drwx------   2 mysql mysql 4.0K Sep 16 17:20 performance_schema/
drwx------   2 mysql mysql 4.0K Sep 16 01:35 roundcube/
-rw-r--r--   1 mysql mysql 1.1K Sep 16 17:20 RPM_UPGRADE_HISTORY
-rw-r--r--   1 mysql mysql  932 Sep 16 17:20 RPM_UPGRADE_MARKER-LAST
/var/lib/mysql

Code:
/var/lib/mysql
total 29M
drwxr-x--x  10 mysql mysql 4.0K Sep 16 17:03 ./
drwxr-xr-x. 21 root  root  4.0K Sep 16 01:02 ../
drwx------   2 mysql mysql 4.0K Sep 16 01:35 cphulkd/
-rw-rw----   1 mysql root   14K Sep 16 04:37 mydomain.com.err
drwx------   2 mysql mysql 4.0K Sep 16 01:35 eximstats/
drwx------   2 mysql mysql 4.0K Sep 16 01:35 horde/
-rw-rw----   1 mysql mysql  18M Sep 16 04:37 ibdata1
-rw-rw----   1 mysql mysql 5.0M Sep 16 04:37 ib_logfile0
-rw-rw----   1 mysql mysql 5.0M Sep 16 00:14 ib_logfile1
drwx------   2 mysql mysql 4.0K Sep 16 00:24 leechprotect/
drwx------   2 mysql mysql 4.0K Sep 16 01:35 logaholicDB_dbd/
drwx--x--x   2 mysql mysql 4.0K Sep 16 01:35 mysql/
-rw-r--r--   1 mysql root     6 Sep 16 00:15 mysql_upgrade_info
drwx------   2 mysql mysql 4.0K Sep 16 00:14 performance_schema/
drwx------   2 mysql mysql 4.0K Sep 16 01:35 roundcube/
-rw-r--r--   1 mysql root   115 Sep 16 00:14 RPM_UPGRADE_HISTORY
-rw-r--r--   1 mysql mysql  115 Sep 16 00:14 RPM_UPGRADE_MARKER-LAST
so does eximstats db have it's own set of mysql connection settings ?
 
Last edited:

eva2000

Well-Known Member
Aug 14, 2001
339
16
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
Re: eximstats db own set of mysql connection settings ? can't connect to lo

I did notice also /scripts/upcp near end has this error too

Code:
[20120916.211005]    - Processing command `/usr/local/cpanel/bin/setupdbmap`
[20120916.211005]      [16224] Can't call method "selectall_arrayref" on an undefined value at /usr/local/cpanel/Cpanel/DB/Mysql/Connection/DBI.pm line 78.
[20120916.211005]    - Processing command `/usr/local/cpanel/bin/fix_userdata_perms`
[20120916.211005]    - Processing command `/usr/local/cpanel/scripts/detect_env_capabilities`
[20120916.211005]   
[20120916.211005] Maintenance complete.
=> Log closed Sun Sep 16 21:10:05 2012
when i run

Code:
/scripts/optimize_eximstats
i get

Code:
DBI connect('mysql:localhost','root',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /scripts/optimize_eximstats line 103.
Could not make a connection to the mysql server.   Please check to see if it online.
Optimzing the eximstats database will be skipped.
when i run

Code:
/scripts/perlinstaller --force Bundle::DBD::mysql
i get this

Code:
gcc -c  -I/usr/local/lib64/perl5/auto/DBI -I/usr/include/mysql -g  -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION=\"4.022\" -DXS_VERSION=\"4.022\" -fPIC "-I/usr/lib64/perl5/CORE"   dbdimp.c
gcc-64bit-hack: enabled
dbdimp.c: In function 'dbd_discon_all':
dbdimp.c:2202: warning: unused variable 'imp_xxh'
dbdimp.c: In function 'mysql_db_STORE_attrib':
dbdimp.c:2378: warning: value computed is not used
dbdimp.c: In function 'mysql_db_FETCH_attrib':
dbdimp.c:2491: warning: value computed is not used
dbdimp.c:2498: warning: value computed is not used
dbdimp.c: In function 'mysql_st_prepare':
dbdimp.c:2611: warning: unused variable 'limit_flag'
dbdimp.c: In function 'mysql_st_next_results':
dbdimp.c:3037: warning: value computed is not used
dbdimp.c:3038: warning: value computed is not used
dbdimp.c:3039: warning: value computed is not used
dbdimp.c:3040: warning: value computed is not used
dbdimp.c:3041: warning: value computed is not used
dbdimp.c:3042: warning: value computed is not used
dbdimp.c:3043: warning: value computed is not used
dbdimp.c:3044: warning: value computed is not used
dbdimp.c:3045: warning: value computed is not used
dbdimp.c:3046: warning: value computed is not used
dbdimp.c:3047: warning: value computed is not used
dbdimp.c:3048: warning: value computed is not used
dbdimp.c:3049: warning: value computed is not used
dbdimp.c:3050: warning: value computed is not used
dbdimp.c:3051: warning: value computed is not used
dbdimp.c:3052: warning: value computed is not used
dbdimp.c:3053: warning: value computed is not used
dbdimp.c:3054: warning: value computed is not used
dbdimp.c: In function 'mysql_st_FETCH_attrib':
dbdimp.c:4447: warning: value computed is not used
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /usr/local/lib64/perl5/auto/DBI/Driver.xst > mysql.xsi
/usr/bin/perl /usr/share/perl5/ExtUtils/xsubpp  -typemap /usr/share/perl5/ExtUtils/typemap  mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 242
Warning: duplicate function definition 'rows' detected in mysql.xs, line 752
gcc -c  -I/usr/local/lib64/perl5/auto/DBI -I/usr/include/mysql -g  -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION=\"4.022\" -DXS_VERSION=\"4.022\" -fPIC "-I/usr/lib64/perl5/CORE"   mysql.c
gcc-64bit-hack: enabled
mysql.xs: In function 'XS_DBD__mysql__db_do':
mysql.xs:309: warning: value computed is not used
mysql.xs:260: warning: unused variable 'statement_ptr'
mysql.xs: In function 'XS_DBD__mysql__st_more_results':
mysql.xs:689: warning: unused variable 'retval'
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
LD_RUN_PATH="/usr/lib64" /usr/bin/perl myld gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic dbdimp.o mysql.o  -o blib/arch/auto/DBD/mysql/mysql.so       \
           -L/usr/lib64 -L/usr/lib64 -L/usr/lib64 -lmysqlclient -lpthread -lm -lrt -ldl         \
          
chmod 755 blib/arch/auto/DBD/mysql/mysql.so
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Manifying blib/man3/DBD::mysql.3pm
Manifying blib/man3/DBD::mysql::INSTALL.3pm
Manifying blib/man3/Bundle::DBD::mysql.3pm
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib64/perl5/auto/DBD/mysql/mysql.so
Installing /usr/local/lib64/perl5/DBD/mysql.pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
OK
Successfully reinstalled DBD-mysql-4.022
1 distribution installed
perl version

Code:
perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
 
Last edited:

eva2000

Well-Known Member
Aug 14, 2001
339
16
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
Re: eximstats db own set of mysql connection settings ? can't connect to lo

Anyway for now seem to have a work around, by leaving socket=/var/lib/mysql/mysql.sock and then resetting eximstats password via /usr/local/cpanel/bin/generate_eximstats_pass and updating the eximstats user password in mysql user table.

But would love to hear if there's a more appropriate method for fixing this :)
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Re: eximstats db own set of mysql connection settings ? can't connect to lo

When you changed the MySQL directory, did you change it by moving /var/lib/mysql to /home/mysql and symlinking it, or did you change it using /etc/my.cnf instead to point to /home/mysql?
 

eva2000

Well-Known Member
Aug 14, 2001
339
16
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
Re: eximstats db own set of mysql connection settings ? can't connect to lo

In the past and this time also just did my.cnf changes which worked for me.

Is there somewhere else eximstats database and whm/mail viewing looks for settings for mysql.sock besides looking at what is set in my.cnf for socket path ?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Re: eximstats db own set of mysql connection settings ? can't connect to lo

I don't understand why you'd change the directory from the default we use in /etc/my.cnf is the thing. We expect the directory to be in /var//lib/mysql

The only way I've ever recommended changing to another directory personally is moving it and symlinking it from /var/lib/mysql to the new directory.
 

eva2000

Well-Known Member
Aug 14, 2001
339
16
318
Brisbane, Australia
cPanel Access Level
Root Administrator
Twitter
Re: eximstats db own set of mysql connection settings ? can't connect to lo

Yeah i changed it as lack of space on /var/lib/mysql :)

Maybe instead of hard coding where eximstats and whm/mail looks for mysql.sock, you could add a check.


so

if it doesn't find /var/lib/mysql/mysql.sock, look in my.cnf for new sock location

or other way round

look into my.cnf for new sock location, if my.cnf doesn't contain a sock location, default to /var/lib/mysql/mysql.sock