Question

Cannot Connect to MySQL Database from Command Prompt

Asked by: souldj

My site was running fine but this morning, I published an article of great interest to my readers and found that the connections to the database were a lot more than normal.

I had to stop and restart the server and once I did that I got this error

[root@localhost ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

HHEELLPPPP!!:-(

Need to get back into the database to allow the site run again.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-25 at 13:31:48ID24681306
Tags

Mysql

,

Linux

,

PHP

Topics

MySQL Server

,

PHP and Databases

Participating Experts
2
Points
500
Comments
28

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. missing /var/lib/mysql/mysql.sock
    I've failed to connect to mysql thru webmin and command promt.. in some of my php dbconnect page, it shows: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' How can I solve it..? thanks
  2. Can't connect to local MySQL server through socket '/v…
    I just installe MySQL on Redhat Linux, and am getting error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'. Mysql.sock is not on this machine anywhere.
  3. Can't connect to local MySQL server through socket '/v…
    Hi! I'm really desperated with this problem, please someone help me, is very URGENT!!! I have mysql installed over linux box. I have phpmyadmin 2.6 installed on it. I changed the pwd of root user, but I didn't know that account was related to a VERY IMPORTANT application....
  4. problem with mysql installation
    I installed the rpm for mysql through up2date ...When I type mysql on the command prompt I get this error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when I go to /var/lib I couldn't find the mysql directo...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: nemws1Posted on 2009-08-25 at 13:37:00ID: 25181979

Are you sure it restarted correctly?

Do this:

ps -ef | grep mysqld

Do you see anything?  Try starting the database again.

Depends on the OS, but usually it's something like:

sudo /etc/init.d/mysqld start

 

by: souldjPosted on 2009-08-25 at 13:43:08ID: 25182038

This is my feedback from ps -ef | grep mysqld


[root@localhost ~]# ps -ef | grep mysqld
root     15814     1  1 12:35 ?        00:08:24 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid
root     26445 13966  0 21:41 pts/0    00:00:00 grep mysqld
root     26452 15814  0 21:41 ?        00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --socket=/var/lib/mysql/mysql.sock
[root@localhost ~]#


Any pointers?

I am new to this , so please be gentle..

 

by: souldjPosted on 2009-08-25 at 13:46:54ID: 25182077


[root@localhost ~]# /etc/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:                                            [FAILED]
[root@localhost ~]#


Trying to restart Mysql -- failed as well.

OS in question is CentOS 5

 

by: nemws1Posted on 2009-08-25 at 13:51:36ID: 25182120

No worries. ;-)

Okay, well 'mysqld' *is* running (good) and so is mysqld_safe (which restarts mysqld if it ever dies unexpectantly).

For the heck of it, supply the hostname for the server (don't rely on the socket):

mysql -h my_hostname

And see if you can get connected that way (maybe your socket went away).  You can check for that too:

ls -l /var/lib/mysql/mysql.sock

 

by: nemws1Posted on 2009-08-25 at 13:52:25ID: 25182127

Anything in the error log of help?

Look at /var/log/mysqld.log as root.

 

by: souldjPosted on 2009-08-25 at 14:05:13ID: 25182247


[root@localhost ~]# mysql -h my_hostname
ERROR 2003 (HY000): Can't connect to MySQL server on 'my_hostname' (111)
[root@localhost ~]# /var/log
-bash: /var/log: is a directory
[root@localhost ~]# cd /var/log

[root@localhost log]# vi mysqld.log

Number of processes running now: 0
090825 10:44:12  mysqld restarted
090825 10:44:12  InnoDB: Started; log sequence number 0 66972937
090825 10:44:12 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
090825 10:44:12 [ERROR] Can't start server: can't create PID file: No space left on device

Number of processes running now: 0
090825 10:44:12  mysqld restarted
090825 10:44:12  InnoDB: Start
Number of processes running now: 0
090825 10:44:12  mysqld restarted
090825 10:44:12  InnoDB: Started; log sequence number 0 66972937
090825 10:44:12 [ERROR] /usr/libexec/mysqld: Error writing file '/var/run/mysqld/mysqld.pid' (Errcode: 28)
090825 10:44:12 [ERROR] Can't start server: can't create PID file: No space left on device

Number of processes running now: 0
090825 10:44:12  mysqld restarted
090825 10:44:12  InnoDB: Started; log sequence number 0 66972937

 

by: KeremEPosted on 2009-08-25 at 14:07:16ID: 25182266

Hi,

It seesm that though your MYSQL is running the socket has ben destroyed. You can not run a daemon which is already running.

Try to stop the daemon gracefuly first:

service mysqld stop

If it fails you might like to do it forcefuly:


killall -9 mysqld
killall -9 mysqld_safe
rm -rf /var/lock/subsys/mysql*
rm -rf /var/run/mysqld/*

and  restart:

service mysqld restart. You should not start mysqld through mysql. Always use the service command (which is a front to /etc/init.d in RedHat / CentOS systems.

Now it should work. If not please post your /var/log/messages and /var/log/mysqld.log


Cheers,
K

 

by: KeremEPosted on 2009-08-25 at 14:08:21ID: 25182277

It seems that you're out of space on your hard disk space too from your logs:
090825 10:44:12 [ERROR] Can't start server: can't create PID file: No space left on device

Will you please post df and free outputs ?

 

by: nemws1Posted on 2009-08-25 at 14:10:16ID: 25182295

And try to delete any junk files you can!

 

by: souldjPosted on 2009-08-25 at 14:13:25ID: 25182327

based on error log ....

I ran this command "df" to check hard drive usage and got the following details


[root@localhost log]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4956140         0 100% /var
/dev/md2             226041940   1538744 212835596   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost log]#


space for /var is 100% used on /dev/md3, but there is loads of space on /dev/md2, how would I move /var to /dev/md2?

 

by: nemws1Posted on 2009-08-25 at 14:16:52ID: 25182369

Yup /var is full.  Could be multiple reasons.

Run this as root (calculates the sizes of all the directories in /var)

du -sk /var/*

 

by: nemws1Posted on 2009-08-25 at 14:19:03ID: 25182380

BTW - you can't just "move" /var from one partition to another.  Also, you have 5 gigs of space in /var, which would usually be enough for that partition.

You can, however, move things in /var somewhere else.

My guess (total guess, though) is that you're going to have move /var/www into /home.

DON'T DO THIS (but eventually, maybe, you'll have to):

mv /var/www /home/www
ln -s /home/www /var/www

Which will move /var/www to /home/www, but make it *look* like its still in /var.

 

by: KeremEPosted on 2009-08-25 at 14:30:54ID: 25182481

You are using md sofware RAID and it is possible that you have some extra space at your volume so that you can expand your md3

Also will you post :

du -k | sort -r -n | head -20

 

by: souldjPosted on 2009-08-25 at 15:14:11ID: 25182827


Last login: Tue Aug 25 21:41:12 2009 from 80.89.177.219
[root@localhost ~]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4956108         0 100% /var
/dev/md2             226041940   1547544 212826796   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost ~]# du -k | sort -r -n | head -20
100     .
[root@localhost ~]# cd /var
[root@localhost var]# du -k | sort -r -n | head -20
4815876 .
4247904 ./log
275560  ./lib
244072  ./lib/mysql
237036  ./spool
188888  ./lib/mysql/newsletter
136644  ./spool/postfix
132588  ./spool/postfix/active
100204  ./spool/mail
48268   ./cache
47468   ./cache/yum
27096   ./cache/yum/base
26488   ./lib/rpm
18904   ./log/httpd
18312   ./cache/yum/updates
17496   ./log/audit
8560    ./lib/mysql/ad
6312    ./www
4872    ./www/manual
3476    ./log/matrixsa
[root@localhost var]#

Looks like log files.

Can I delete them for the time being or copy them across to /home ?

 

by: KeremEPosted on 2009-08-25 at 17:03:07ID: 25183414

Wow you have so many logs in the log folder. This is your champion will you try to clean it up a lili? You can start to delete old files.

Are they all expendable ?

Will you post the contents ??

 

by: nemws1Posted on 2009-08-25 at 18:28:53ID: 25183794

Most likely you have one run-away log file - something that needs to be truncated/rotated and never has been.  Similar command (and as KeremE says, if you don't mind):

cd /var/log
du -k | sort -r -n | head -20

If this returns a directory as the #1 hit, then:

cd /var/log/some_dir
du -k | sort -r -n | head -20

 

by: souldjPosted on 2009-08-26 at 01:27:25ID: 25185340

[root@localhost ~]# cd /var/log
[root@localhost log]# du -k |sort -r -n | head -20
4248356 .
18904   ./httpd
17496   ./audit
3476    ./matrixsa
28      ./prelink
24      ./cups
8       ./squid
8       ./ppp
8       ./pm
8       ./conman.old
8       ./conman
[root@localhost log]# cd httpd/
[root@localhost httpd]# du -k |sort -r -n | head -20
18904   .
[root@localhost httpd]#


How do I prune the log files now?

 

by: KeremEPosted on 2009-08-26 at 01:37:04ID: 25185391

ok then just go to the /var/log/httpd directory and trim some old  access_log and error_log files.

If it is ok for you to truncate them you can use :

>  access_log

This command will remove the data and reset the filesize to zero length.

Another alternative is to create a filesystem and move your httpd logs there. Please tell me whaich way you2d like to go so that I could be of further help.

K.

 

by: souldjPosted on 2009-08-26 at 01:58:07ID: 25185509


[root@localhost log]# cd httpd/
[root@localhost httpd]# > access_log
[root@localhost httpd]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4956088         0 100% /var
/dev/md2             226041940   1536932 212837408   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost httpd]# du -k |sort -r -n | head -20
18844   .
[root@localhost httpd]#


No change in available space yet though

 

by: KeremEPosted on 2009-08-26 at 02:04:37ID: 25185546

Not that easy dude :)

You'll need to find the exact files first. will you post the ls -al output of the /var/log/httpd. The

 

by: KeremEPosted on 2009-08-26 at 02:05:42ID: 25185552

acess_log and erre_log are the default names for the logs while many administrators used to add some prefix such as the domain name especially if there's more than one virtual host.

 

by: souldjPosted on 2009-08-26 at 02:11:44ID: 25185570


[root@localhost log]# cd httpd/
[root@localhost httpd]# > access_log
[root@localhost httpd]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4956088         0 100% /var
/dev/md2             226041940   1536932 212837408   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost httpd]# du -k |sort -r -n | head -20
18844   .
[root@localhost httpd]# ls -ail
total 18852
1152014 drwx------  2 root root    4096 Aug 23 04:04 .
1152001 drwxr-xr-x 12 root root    4096 Aug 26 04:03 ..
1152045 -rw-r--r--  1 root root       0 Aug 26 09:56 access_log
1152038 -rw-r--r--  1 root root  468170 Aug 23 03:39 access_log.1
1152099 -rw-r--r--  1 root root  339818 Aug 16 02:52 access_log.2
1152083 -rw-r--r--  1 root root  319407 Aug  9 02:45 access_log.3
1152066 -rw-r--r--  1 root root  304379 Aug  2 01:17 access_log.4
1152051 -rw-r--r--  1 root root   65536 Aug 26 09:55 error_log
1152042 -rw-r--r--  1 root root  461639 Aug 23 04:04 error_log.1
1152101 -rw-r--r--  1 root root  336592 Aug 16 04:07 error_log.2
1152087 -rw-r--r--  1 root root  323683 Aug  9 04:02 error_log.3
1152068 -rw-r--r--  1 root root  302996 Aug  2 04:03 error_log.4
1152056 -rw-r--r--  1 root root  274432 Aug 26 01:18 ssl_access_log
1152112 -rw-r--r--  1 root root 2207503 Aug 22 16:41 ssl_access_log.1
1152102 -rw-r--r--  1 root root 1328490 Aug 15 22:49 ssl_access_log.2
1152088 -rw-r--r--  1 root root  711786 Aug  9 02:50 ssl_access_log.3
1152069 -rw-r--r--  1 root root  742035 Aug  1 17:18 ssl_access_log.4
1152061 -rw-r--r--  1 root root  262144 Aug 26 01:57 ssl_error_log
1152113 -rw-r--r--  1 root root 2276385 Aug 23 01:56 ssl_error_log.1
1152103 -rw-r--r--  1 root root 1277550 Aug 16 01:59 ssl_error_log.2
1152091 -rw-r--r--  1 root root  687429 Aug  9 02:50 ssl_error_log.3
1152070 -rw-r--r--  1 root root  732785 Aug  1 17:03 ssl_error_log.4
1152071 -rw-r--r--  1 root root  303104 Aug 26 01:18 ssl_request_log
1152116 -rw-r--r--  1 root root 2372380 Aug 22 16:41 ssl_request_log.1
1152104 -rw-r--r--  1 root root 1440111 Aug 15 22:49 ssl_request_log.2
1152096 -rw-r--r--  1 root root  791711 Aug  9 02:50 ssl_request_log.3
1152073 -rw-r--r--  1 root root  824295 Aug  1 17:18 ssl_request_log.4
[root@localhost httpd]#


All these files can go!

how do I do that  :-)

 

by: KeremEPosted on 2009-08-26 at 02:13:53ID: 25185576

ok just do that:

rm -rf *.[0-9]
> error.log
> ssl_access_log
> ssl_error_log

service httpd restart

 

by: KeremEPosted on 2009-08-26 at 02:17:11ID: 25185594

BTW there's not so much data here.

now go to the parent directory.

cd ..
rm -rf *.[0-9]

and issue an

ls -al

there too

 

by: KeremEPosted on 2009-08-26 at 02:17:58ID: 25185596

post the ls -al output here

 

by: souldjPosted on 2009-08-26 at 02:32:38ID: 25185681


[root@localhost log]# cd httpd/
[root@localhost httpd]# > access_log
[root@localhost httpd]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4956088         0 100% /var
/dev/md2             226041940   1536932 212837408   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost httpd]# du -k |sort -r -n | head -20
18844   .
[root@localhost httpd]# ls -ail
total 18852
1152014 drwx------  2 root root    4096 Aug 23 04:04 .
1152001 drwxr-xr-x 12 root root    4096 Aug 26 04:03 ..
1152045 -rw-r--r--  1 root root       0 Aug 26 09:56 access_log
1152038 -rw-r--r--  1 root root  468170 Aug 23 03:39 access_log.1
1152099 -rw-r--r--  1 root root  339818 Aug 16 02:52 access_log.2
1152083 -rw-r--r--  1 root root  319407 Aug  9 02:45 access_log.3
1152066 -rw-r--r--  1 root root  304379 Aug  2 01:17 access_log.4
1152051 -rw-r--r--  1 root root   65536 Aug 26 09:55 error_log
1152042 -rw-r--r--  1 root root  461639 Aug 23 04:04 error_log.1
1152101 -rw-r--r--  1 root root  336592 Aug 16 04:07 error_log.2
1152087 -rw-r--r--  1 root root  323683 Aug  9 04:02 error_log.3
1152068 -rw-r--r--  1 root root  302996 Aug  2 04:03 error_log.4
1152056 -rw-r--r--  1 root root  274432 Aug 26 01:18 ssl_access_log
1152112 -rw-r--r--  1 root root 2207503 Aug 22 16:41 ssl_access_log.1
1152102 -rw-r--r--  1 root root 1328490 Aug 15 22:49 ssl_access_log.2
1152088 -rw-r--r--  1 root root  711786 Aug  9 02:50 ssl_access_log.3
1152069 -rw-r--r--  1 root root  742035 Aug  1 17:18 ssl_access_log.4
1152061 -rw-r--r--  1 root root  262144 Aug 26 01:57 ssl_error_log
1152113 -rw-r--r--  1 root root 2276385 Aug 23 01:56 ssl_error_log.1
1152103 -rw-r--r--  1 root root 1277550 Aug 16 01:59 ssl_error_log.2
1152091 -rw-r--r--  1 root root  687429 Aug  9 02:50 ssl_error_log.3
1152070 -rw-r--r--  1 root root  732785 Aug  1 17:03 ssl_error_log.4
1152071 -rw-r--r--  1 root root  303104 Aug 26 01:18 ssl_request_log
1152116 -rw-r--r--  1 root root 2372380 Aug 22 16:41 ssl_request_log.1
1152104 -rw-r--r--  1 root root 1440111 Aug 15 22:49 ssl_request_log.2
1152096 -rw-r--r--  1 root root  791711 Aug  9 02:50 ssl_request_log.3
1152073 -rw-r--r--  1 root root  824295 Aug  1 17:18 ssl_request_log.4
[root@localhost httpd]#
[root@localhost httpd]# rm -rf *.[0-9]
[root@localhost httpd]# > error.log
[root@localhost httpd]# > ssl_access_log
[root@localhost httpd]# >ssl_error_log
[root@localhost httpd]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4937844         0 100% /var
/dev/md2             226041940   1538132 212836208   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost httpd]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@localhost httpd]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   4937960         0 100% /var
/dev/md2             226041940   1538140 212836200   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost httpd]# cd ..
[root@localhost log]# rm -rf *.[0-9]
[root@localhost log]# ls -ail
total 1489224
1152001 drwxr-xr-x 12 root  root        4096 Aug 26 10:28 .
      2 drwxr-xr-x 22 root  root        4096 Aug 25 22:30 ..
1152033 -rw-r-----  1 root  root        1536 Aug 25 22:36 acpid
1152027 -rw-------  1 root  root      313267 Apr 29 20:53 anaconda.log
1152028 -rw-------  1 root  root       28792 Apr 29 20:53 anaconda.syslog
1152017 drwxr-x---  2 root  root        4096 Aug 14 10:19 audit
1152062 -rw-------  1 root  root           0 Aug 23 04:04 boot.log
1152005 -rw-------  1 root  utmp   131993600 Aug 26 00:05 btmp
1152021 drwxr-xr-x  2 root  root        4096 Nov 11  2007 conman
1152022 drwxr-xr-x  2 root  root        4096 Nov 11  2007 conman.old
1152114 -rw-------  1 root  root        7529 Aug 26 10:01 cron
1152010 drwxr-xr-x  2 lp    sys         4096 Aug 26 04:02 cups
1152029 -rw-r--r--  1 root  root       23060 Aug 25 22:35 dmesg
1152002 -rw-------  1 root  root       24120 May 18 13:59 faillog
1152014 drwx------  2 root  root        4096 Aug 26 10:26 httpd
1152018 -rw-r--r--  1 root  root      293460 Aug 26 09:24 lastlog
1152058 -rw-------  1 root  root  1192760202 Aug 26 10:28 maillog
1152011 drwxr-xr-x  2 root  root        4096 Aug 23 04:04 matrixsa
1152054 -rw-------  1 root  root      565248 Aug 26 10:03 messages
1152020 -rw-r-----  1 mysql mysql  197146864 Aug 26 10:28 mysqld.log
1152024 drwxr-xr-x  2 root  root        4096 Apr 29 22:11 pm
1152015 drwx------  2 root  root        4096 Jan 21  2009 ppp
1152019 drwxr-xr-x  2 root  root        4096 Jan 21  2009 prelink
1152060 -rw-r--r--  1 root  root       16028 Aug 25 04:02 rpmpkgs
1152016 -rw-r--r--  1 root  root         969 Apr 29 20:51 scrollkeeper.log
1152057 -rw-------  1 root  root      258048 Aug 26 09:24 secure
1152059 -rw-------  1 root  root           0 Aug 23 04:04 spooler
1152023 drwxr-x---  2 squid squid       4096 Jan 21  2009 squid
1152003 -rw-------  1 root  root           0 Apr 29 22:10 tallylog
1152004 -rw-rw-r--  1 root  utmp      122496 Aug 26 09:24 wtmp
1152037 -rw-r--r--  1 root  root       14598 Aug 19 04:06 yum.log
[root@localhost log]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@localhost log]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4956160   1337900   3362436  29% /
/dev/md3               4956224   2218332   2482064  48% /var
/dev/md2             226041940   1538264 212836076   1% /home
/dev/md0                 77649     22065     51575  30% /boot
tmpfs                   987312         0    987312   0% /dev/shm
[root@localhost log]#


Yippee!!! MySQL is back up and space has been restored.

But is it possible to move the location of log files to the /home partition?

 

by: souldjPosted on 2009-08-26 at 02:50:01ID: 31620404

Great Help for Newbies in Linux!

 

by: KeremEPosted on 2009-08-26 at 02:52:51ID: 25185782

mmmm do yu have someting in there ??

BTW your log files are very very very big

turuncate them too :

> btmp
> maillog
> mysql.log

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...