LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mysql is missing or will not start (https://www.linuxquestions.org/questions/linux-newbie-8/mysql-is-missing-or-will-not-start-630411/)

Ziger 03-25-2008 03:07 AM

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!

Ziger 03-25-2008 04:08 AM

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!

key4ce 03-25-2008 06:17 AM

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;

key4ce 03-25-2008 06:27 AM

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.

simplicissimus 03-25-2008 08:47 AM

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

simplicissimus 03-25-2008 08:58 AM

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

Tinkster 03-25-2008 12:53 PM

I merged your two closely related threads.

Ziger 03-27-2008 04:58 PM

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.

chrism01 03-27-2008 07:18 PM

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


All times are GMT -5. The time now is 02:00 PM.