LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2008, 03:07 AM   #1
Ziger
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Rep: Reputation: 0
mysql is missing or will not start


Recently my Web guy has left and I know very little about Linux and MySQL so I am in desperate need of some advice.

Overnight the MySQL service has either corrupted or something sinister has happened.

Not sure why, but there is no mysqld daemon in /etc/init.d. There is a daemon called mysql instead. However when I tried to start the daemon the following errrors appear:

# service mysql restart
/etc/init.d/mysql: line 182: cd: HOME not set
/etc/init.d/mysql: line 182: cd: HOME not set
MySQL PID file could not be found! [FAILED]
/etc/init.d/mysql: line 182: cd: HOME not set
Starting MySQL................................... [FAILED]

Then I located mysqld in /usr/sbin/mysqld and so I ran it but the following occurs:

# /usr/sbin/mysqld
050602 14:17:44 [Warning] Asked for 196608 thread stack, but got 126976
050602 14:17:44 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
050602 14:17:44 [ERROR] Do you already have another mysqld server running on port: 3306 ?
050602 14:17:44 [ERROR] Aborting

050602 14:17:44 [Note] /usr/sbin/mysqld: Shutdown complete

I also cannot find the config file "my.cnf"
When I query mysql it also cannot detect it as follows:

# rpm -q mysql
package mysql is not installed

I have researched on the topic and found some similar threads which advise to reinstall the MySQL, however I am fearful of damaging existing tables and data by my inexperience.

what is wrong here? anyone? please help me....

thanks in advance guys!
 
Old 03-25-2008, 04:08 AM   #2
Ziger
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
mysql is missing or will not start

Suspecting that my MySQL installation is screwed up, is there a way that I can check to see if the DB's are still in tact? or if they even exist?

How can I search for the DB's on my server?

Very green on this subject so pls help!
 
Old 03-25-2008, 06:17 AM   #3
key4ce
Member
 
Registered: Mar 2008
Location: Eindhoven
Distribution: Free BSD / CentOS/ Windows 2008
Posts: 42

Rep: Reputation: 15
try this:

- connect to MySQL

mysql -uUsername -pPassword


once logged in type:
show databases;



- connect to a Database

use DbName;

- view tables of a Database (must be connected to the Database)

show tables;

- view contents of a table (must be connected to the Database)

select * from TableName;
 
Old 03-25-2008, 06:27 AM   #4
key4ce
Member
 
Registered: Mar 2008
Location: Eindhoven
Distribution: Free BSD / CentOS/ Windows 2008
Posts: 42

Rep: Reputation: 15
I would indeed suggest to reinstall mysql.

if your worried for database loss use this:

#

Copy MySQL's data files and directories. For example, if your MySQL data directory is /var/lib/mysql and you want to save it to /tmp/mysql-backup:

# cp -r /var/lib/mysql /tmp/mysql-backup

Instead of cp, you can use rsync, tar, gzip, or other commands.


once you placed the raw mysql database files in another file.. you can start removing mysql.
then once everything is working again, stop mysql, place the files back in the propper directory.
 
Old 03-25-2008, 08:47 AM   #5
simplicissimus
Registered User
 
Registered: Mar 2008
Posts: 104

Rep: Reputation: 15
mysqldump

You can also try to dump the database with all it's contents and then check the dumpfile in an editor (works fine for small sized databases). You'll get an error if the database doesn't exist.

Code:
mysqldump database_name -u user_name --password='plaintext-password' > my_dump_file
Regards,
SIMP

Fedora Development

Last edited by simplicissimus; 04-02-2008 at 04:57 AM.
 
Old 03-25-2008, 08:58 AM   #6
simplicissimus
Registered User
 
Registered: Mar 2008
Posts: 104

Rep: Reputation: 15
First find your MySQL installation (your output may be different):

Code:
$ which mysql
/usr/local/bin/mysql

$ ls -l /usr/local/bin/mysql
lrwxrwxrwx 1 root root 26 2006-07-29 00:33 /usr/local/bin/mysql -> /usr/local/mysql/bin/mysql
The mysql binary is a softlink, the installation directory is /usr/local/mysql (in my case)

Code:
$ ls -l /usr/local/mysql
total 88
drwxr-sr-x 2 mysql mysql 4096 2006-07-28 23:53 bin
drwxr-sr-x 3 mysql mysql 4096 2006-07-28 23:50 include
drwxr-xr-x 2 mysql mysql 4096 2006-07-28 23:50 info
drwxr-sr-x 3 mysql mysql 4096 2006-07-28 23:50 lib
drwxr-sr-x 2 mysql mysql 4096 2006-07-28 23:53 libexec
drwxr-sr-x 3 mysql mysql 4096 2006-07-28 23:51 man
-rw-r--r-- 1 mysql mysql  316 2008-03-18 02:32 my.cnf
drwxr-sr-x 7 mysql mysql 4096 2006-07-28 23:53 mysql-test
drwxr-sr-x 3 mysql mysql 4096 2006-07-28 23:51 share
drwxr-sr-x 6 mysql mysql 4096 2006-07-29 00:11 sql-bench
drwxr-sr-x 9 mysql mysql 4096 2008-03-25 12:15 var
There you have 'my.cnf'. Please note, there is also another 'my.cnf' in /etc. MySQL will read both. Depends on you wich one you use for long-term or short-term settings.

Some MySQL installations use 'mysql.server' as the launcher within /etc/init.d, using
Code:
/etc/init.d/mysql.server start
to start the service.

See how far this get's you. Typical follow-up errors can be with the socket-file, if the installation really is corrupted.

Hope this helps,
Regards,
SIMP
 
Old 03-25-2008, 12:53 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
I merged your two closely related threads.
 
Old 03-27-2008, 04:58 PM   #8
Ziger
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
MySQL problem fixed another appears

Thanks to all who replied,

I realized that MySQL will not start when there is no disk space!!!

I freed up some space and MySQL was happy except for some messed up indexes which I repaired.

The new problem is that I am losing disk space and cannot find where/what is using it up so quickly... no matter how much I free up, within a few hours its used up again and services start to fail.

Any ideas on this would be welcome.. thanks once again.
 
Old 03-27-2008, 07:18 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,356

Rep: Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367Reputation: 2367
Check out the cmds

du
df

to start with.
you might also want to look at /var/log dir, where a lot of software put their logfiles. You can use
ls -l
to see the sizes, add the 't' switch to sort newest at the top
ls -lt

check also the Apache error_log and access_log if you have Apache.

Here's a really good free online Linux tutorial: http://rute.2038bug.com/index.html.gz
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File system points to MySQL db's in wrong cPanel nogerorob Linux - Software 0 04-18-2006 09:24 PM
How to copy mysql db's from hardisk to new server? nbier Linux - Software 4 09-01-2004 03:24 PM
c++ check if file exists Genjix Programming 3 03-15-2004 12:08 AM
Backing up large MySQL DB's WeNdeL Linux - Software 5 11-29-2003 09:34 AM
Lost all my MySQL DB's, help amp2000 Linux - General 7 04-17-2003 01:25 AM


All times are GMT -5. The time now is 02:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration