Results 1 to 15 of 15
Thread: MySQL keeps down (Cpanel Server)
-
05-29-2007, 11:47 PM #1Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
MySQL keeps down (Cpanel Server)
I have a Cpanel server with a problem: SQL keeps failing
Everytime I try to restart MySQL via WHM, it gives me:
/usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't
connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock'
exists! mysql has failed, please contact the sysadmin (result was "mysql
has failed").
I can only restart it successfully after 2nd attempt. Server load is always low. Memory usage is also low.
It happens in very short interval (in less than every 1-10 minutes)
It never happens until recently when my server management company tweak something I didn't know. They said fixed it and then it happens again every minutes. It's simply pissing me off.
I have 9 servers and it never happens to the rest 8 servers. Just this server always happening.
How do I solve this problem? And what exactly is the problem?
-
05-29-2007, 11:49 PM #2Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
Just to add, my.cnf on this problematic server appearing to be the same settings as the rest of my 8 server my.cnf, so I assume it wasn't the configuration problems.
Can someone offer me a help on this matter?
-
05-29-2007, 11:50 PM #3Engineer
- Join Date
- Jan 2005
- Location
- Scotland, UK
- Posts
- 2,681
Can you paste your my.cnf , maybe they changed it to explictly set the wrong socket.
The error you are getting is a connection refused on that socket (it does exist), one way to find out what is happening is the first restart when you get the error, login to ssh and ps aux | grep mysql and check if it defines --socket , you can also manually test the socket with
mysql -S /var/lib/mysql/mysql.sock
It's more than likely explictly setting the socket at the init.d or in my.cnfServer Management - AdminGeekZ.com
Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
Check our wordpress varnish plugin. Contact us for quote: sales@admingeekz.com
-
05-29-2007, 11:57 PM #4Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
OK u're right.
#ps aux | grep mysql
I can't see any --socket
But I can see --socket from another server which is working perfectly.
# mysql -S /var/lib/mysql/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 172 to server version: 4.1.21-standard
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
So what exactly is the solution?
-
05-29-2007, 11:59 PM #5Engineer
- Join Date
- Jan 2005
- Location
- Scotland, UK
- Posts
- 2,681
What does,
grep "socket" /etc/my.cnf
Return?Server Management - AdminGeekZ.com
Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
Check our wordpress varnish plugin. Contact us for quote: sales@admingeekz.com
-
05-30-2007, 12:01 AM #6Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
This is just all inside my.cnf
[mysqld]
set-variable = max_connections=500
safe-show-database
My other server has
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
#skip-innodb
query_cache_limit=1M
query_cache_size=128M
query_cache_type=1
max_user_connections=200
max_connections=500
interactive_timeout=10
wait_timeout=20
connect_timeout=20
thread_cache_size=128
key_buffer=512M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=4M
read_buffer_size=4M
max_connect_errors=10
thread_concurrency=8
myisam_sort_buffer_size=64M
server-id=1
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[mysqlhotcopy]
interactive-timeout
-
05-30-2007, 12:04 AM #7Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
# grep "socket" /etc/my.cnf
#
Nothing on this server
But on other server:
# grep "socket" /etc/my.cnf
socket=/var/lib/mysql/mysql.sock
-
05-30-2007, 12:05 AM #8Engineer
- Join Date
- Jan 2005
- Location
- Scotland, UK
- Posts
- 2,681
Add socket=/var/lib/mysql/mysql.sock to your my.cnf and then /scripts/restartsrv_mysql
Server Management - AdminGeekZ.com
Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
Check our wordpress varnish plugin. Contact us for quote: sales@admingeekz.com
-
05-30-2007, 12:08 AM #9Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
I have added the line inside my.cnf which looks like this:
[mysqld]
set-variable = max_connections=500
safe-show-database
socket=/var/lib/mysql/mysql.sock
# /scripts/restartsrv_mysql
Starting MySQL [ OK ]
Will see if SQL down again in next 5 minutes.. it usually down between 1-10 minutes
-
05-30-2007, 12:49 AM #10Web Hosting Master
- Join Date
- Nov 2004
- Location
- India
- Posts
- 1,104
Well now try this,
mv /etc/my.cnf /etc/my.cnf.bak
/scripts/restartsrv mysqlAssistanZ - Beyond Boundaries...
Cloudstack Consultancy / 24x7 Web Hosting Support / 24x7 Server Management / Infrastructure Management Services
Web & Mobile Apps Development / Web Designing Services / Php, Grails, Java Development
-
05-30-2007, 08:00 AM #11Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
mv /etc/my.cnf /etc/my.cnf.bak
/scripts/restartsrv mysql
The above works. However I have doubts, this means that it will not read my.cnf because there is no my.cnf is that right? Means it won't read configurations... i don't think it can solve this problem permenantly.
-
05-30-2007, 10:01 PM #12Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
Now I am facing another server with SQL downtime problem. but it doesn't happen very frequent. Last night SQL was down the whole night while I was sleeping. I had complained to my server management but nothing was done.
When it was done, I had difficulty restarting mySQL via WHM for the first time. It was only successful at the 2nd attempt
The my.cnf were standard as follows:
# cat my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-locking
skip-innodb
query_cache_limit=1M
query_cache_size=128M
query_cache_type=1
max_user_connections=200
max_connections=500
interactive_timeout=10
wait_timeout=20
connect_timeout=20
thread_cache_size=128
key_buffer=512M
join_buffer=1M
max_allowed_packet=16M
table_cache=1024
record_buffer=1M
sort_buffer_size=4M
read_buffer_size=4M
max_connect_errors=10
thread_concurrency=8
myisam_sort_buffer_size=64M
server-id=1
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[mysqlhotcopy]
interactive-timeout
-
05-31-2007, 02:23 AM #13Web Hosting Evangelist
- Join Date
- Apr 2006
- Posts
- 516
MySQL was down again twice today. Anyone don't mind to help?
-
05-31-2007, 02:20 PM #14Web Hosting Master
- Join Date
- May 2006
- Location
- India
- Posts
- 661
also just make sure there is enough free disk space available in the /var partition...
██ SparkSupport.Com - The Premier Tech Company
██ Cloud Solutions|Email Infra setup|VOIP|Video Streaming|Software Development
██ Email: info@sparksupport.com █ Phone : 1- 408-600-1449 | Skype : shijils
-
05-31-2007, 03:26 PM #15Web Hosting Master
- Join Date
- May 2006
- Location
- India
- Posts
- 661
Also check the mysql error log /var/log/mysqld.log for any errors at the time of crash.
██ SparkSupport.Com - The Premier Tech Company
██ Cloud Solutions|Email Infra setup|VOIP|Video Streaming|Software Development
██ Email: info@sparksupport.com █ Phone : 1- 408-600-1449 | Skype : shijils