Error connecting to mysql

i was trying to setup an application checked out from svnin my local
machine. i managed to do all that is required except when it came to
the step of creating databases for the application, when i tried to
connect to mysql i got this error

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’ (2)

i have spent more than 5 hours trying to solve this without any success.

your help please

thanks

On Wed, 2008-09-03 at 20:27 +0200, Adolf C. wrote:

your help please


remembering that you’re running Fedora…

is mysqld service running?

service mysqld status

can you connect via command line as the user/password in
config/database.yml ?

mysql -U $USER_IN_DATABSE.YML -p

Craig

On Wed, 2008-09-03 at 20:47 +0200, Adolf C. wrote:

hi craig,

this is what i got after service mysqld status

[root@localhost /]# service mysqld status
mysqld dead but subsys locked


that means it’s not running (at least to me)

try ‘service mysqld restart’

and see if it stays started and if you then can connect as below

Craig W. wrote:

On Wed, 2008-09-03 at 20:27 +0200, Adolf C. wrote:

your help please


remembering that you’re running Fedora…

is mysqld service running?

service mysqld status

hi craig,

this is what i got after service mysqld status

[root@localhost /]# service mysqld status
mysqld dead but subsys locked

and mysql -U $USER_IN_DATABSE.YML -p gives

[root@localhost /]# mysql -U -p
Enter password:
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.sock’ (2)
[root@localhost /]#

what should i do please?

thanks

On Wed, 2008-09-03 at 21:33 +0200, Adolf C. wrote:

it does not want to stay started it timed out as soon as i started the
service

this is what i got after service mysqld restart

[root@localhost /]# service mysqld restart
Stopping MySQL: [FAILED]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
[root@localhost /]#


that would seem to be your problem…logs are your friend

take a look at /var/log/mysqld.log

Craig

Craig W. wrote:

On Wed, 2008-09-03 at 20:47 +0200, Adolf C. wrote:

[
try ‘service mysqld restart’

and see if it stays started and if you then can connect as below

it does not want to stay started it timed out as soon as i started the
service

this is what i got after service mysqld restart

[root@localhost /]# service mysqld restart
Stopping MySQL: [FAILED]
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
[root@localhost /]#

you must have done something untoward…

try these commands as root

service mysqld stop
rm /var/lib/mysql/mysql.sock
service mysqld start

and see if it stays running

Craig

still not working, this is what i got

[root@localhost /]# service mysqld stop
Stopping MySQL: [FAILED]
[root@localhost /]# rm /var/lib/mysql/mysql.sock
rm: cannot remove `/var/lib/mysql/mysql.sock’: No such file or directory
[root@localhost /]# service mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
[root@localhost /]#

sorry for this but am not that good in linux, that’s why am asking a
lot of questions.

/var/log/mysqld.log

080903 16:20:18 mysqld started
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
080903 16:20:18 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait…
080903 16:20:19 InnoDB: Log file ./ib_logfile0 did not exist: new to be
created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait…
080903 16:20:20 InnoDB: Log file ./ib_logfile1 did not exist: new to be
created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait…
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
080903 16:20:24 InnoDB: Started; log sequence number 0 0
080903 16:20:27 [Note] /usr/libexec/mysqld: ready for connections.
Version: ‘5.0.45’ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306
Source distribution
A mysqld process already exists at Wed Sep 3 20:56:28 EAT 2008
A mysqld process already exists at Wed Sep 3 20:57:34 EAT 2008
080903 21:00:02 [Note] /usr/libexec/mysqld: Normal shutdown

080903 21:00:03 [ERROR] bdb: log_archive: DB_ARCH_ABS: No such file or
directory
080903 21:00:03 InnoDB: Starting shutdown…
080903 21:00:08 InnoDB: Shutdown completed; log sequence number 0 43655
080903 21:00:08 [Note] /usr/libexec/mysqld: Shutdown complete

080903 21:00:08 mysqld ended

080903 21:00:52 mysqld started
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
080903 21:00:52 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait…
080903 21:00:59 InnoDB: Log file ./ib_logfile0 did not exist: new to be
created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait…
080903 21:01:02 InnoDB: Log file ./ib_logfile1 did not exist: new to be
created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait…
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
080903 21:01:09 InnoDB: Started; log sequence number 0 0
080903 21:01:10 [ERROR] Can’t start server : Bind on unix socket:
Permission denied
080903 21:01:10 [ERROR] Do you already have another mysqld server
running on socket: /var/lib/mysql/mysql.sock ?
080903 21:01:10 [ERROR] Aborting

080903 21:01:10 InnoDB: Starting shutdown…
080903 21:01:13 InnoDB: Shutdown completed; log sequence number 0 43655
080903 21:01:13 [Note] /usr/libexec/mysqld: Shutdown complete

080903 21:01:13 mysqld ended

080903 21:05:24 mysqld started
080903 21:05:27 InnoDB: Started; log sequence number 0 43655
080903 21:05:27 [ERROR] Can’t start server : Bind on unix socket:
Permission denied
080903 21:05:27 [ERROR] Do you already have another mysqld server
running on socket: /var/lib/mysql/mysql.sock ?
080903 21:05:27 [ERROR] Aborting

080903 21:05:27 InnoDB: Starting shutdown…
080903 21:05:29 InnoDB: Shutdown completed; log sequence number 0 43655
080903 21:05:29 [Note] /usr/libexec/mysqld: Shutdown complete

080903 21:05:29 mysqld ended

080903 21:16:40 mysqld started
080903 21:16:44 InnoDB: Started; log sequence number 0 43655
080903 21:16:45 [ERROR] Can’t start server : Bind on unix socket:
Permission denied
080903 21:16:45 [ERROR] Do you already have another mysqld server
running on socket: /var/lib/mysql/mysql.sock ?
080903 21:16:45 [ERROR] Aborting

080903 21:16:45 InnoDB: Starting shutdown…
080903 21:16:46 InnoDB: Shutdown completed; log sequence number 0 43655
080903 21:16:46 [Note] /usr/libexec/mysqld: Shutdown complete

080903 21:16:46 mysqld ended

080903 22:26:39 mysqld started
080903 22:26:41 InnoDB: Started; log sequence number 0 43655
080903 22:26:42 [ERROR] Can’t start server : Bind on unix socket:
Permission denied
080903 22:26:42 [ERROR] Do you already have another mysqld server
running on socket: /var/lib/mysql/mysql.sock ?
080903 22:26:42 [ERROR] Aborting

080903 22:26:42 InnoDB: Starting shutdown…
080903 22:26:46 InnoDB: Shutdown completed; log sequence number 0 43655
080903 22:26:46 [Note] /usr/libexec/mysqld: Shutdown complete

080903 22:26:46 mysqld ended

On Wed, 2008-09-03 at 22:26 +0200, Adolf C. wrote:

[root@localhost /]#


what is output of the following commands…

ls -ld /var/lib/mysql
ls -l /var/lib/mysql

Craig

this is the content of /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

Default to using old password format for compatibility with mysql 3.x

clients (those using the mysqlclient10 compatibility package).

old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

the rest of the files have nothing in them

What is the permissions on /var/lib/mysql ? the mysql user is going to
need access to this directory.

run chown -R mysql:mysql /var/lib/mysql

heimdull wrote:

What is the permissions on /var/lib/mysql ? the mysql user is going to
need access to this directory.

run chown -R mysql:mysql /var/lib/mysql

it doesn’t give any output just another prompt i.e

[root@localhost /]# chown -R mysql:mysql /var/lib/mysql
[root@localhost /]#

is there anything else that i have to do?

On Thu, 2008-09-04 at 07:18 +0200, Adolf C. wrote:

[root@localhost /]#

is there anything else that i have to do?


try restarting mysqld service and see if it keeps running, otherwise,
answer my earlier questions

Craig

Craig W. wrote:

On Thu, 2008-09-04 at 07:18 +0200, Adolf C. wrote:

[root@localhost /]#

is there anything else that i have to do?


try restarting mysqld service and see if it keeps running, otherwise,
answer my earlier questions

Craig

Hi craig,

mysqld server does not want to keep on running when started this is
what i get

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

and i thought i answered all of your questions can you please be
more specific on the question that you want to be answered?


try restarting mysqld service and see if it keeps running, otherwise,
answer my earlier questions

Craig

Hi craig,

mysqld server does not want to keep on running when started this is
what i get

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

and i thought i answered all of your questions can you please be
more specific on the question that you want to be answered?

I would like to see your my.cnf… Just remember that MySQL looks for
the file in these locations:

/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

In that order…

But looking at your log file I think this is your issue:

080903 22:26:42 [ERROR] Can’t start server : Bind on unix socket:
Permission denied

Maybe see if this gives a better output:

mysqld -umysql --verbose --datadir=/var/lib/mysql

what if i unistall mysql and then re-install it will this help to
solve this problem

heimdull wrote:

Maybe see if this gives a better output:

mysqld -umysql --verbose --datadir=/var/lib/mysql

here is the output of mysqld -umysql --verbose
–datadir=/var/lib/mysql

[root@localhost /]# mysqld -umysql --verbose --datadir=/var/lib/mysql
bash: mysqld: command not found

anything else please?