Help - Search - Members - Calendar
Full Version: MYSQL is down, somebody please help!
The Planet Forums > Control Panels > cPanel/WHM
dSpotter
I just got my CPANEL server yesterday and still learning how to do this. I'm a newbie at this... I previously had a "managed" server.

When trying to setup an account everything is ok except it can't connect to the MYSQL.

"error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'"

I checked to see if MYSQL is up and but it looks like its down (RED). I tried restarting it but I get the following message when I tried restarting it:

"mysql has failed, please contact the sysadmin."



Derrick Lane
Erwin
Try doing this in SSH:

killall mysqld
service mysql start

It should start back up.
dSpotter
When I entered the command to start up mysql I get the same message:

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

icon_sad.gif


BTW Erwin, great site. I have a VB forum and am I regular on VB.ORG. Always trying to find new hacks to install icon_biggrin.gif cool.gif
Erwin
Try this:

killall -9 mysqld

Keep running it until it says "no processes" left.

Then do this:

service mysql start

If that doesn't work, rebooting the server may help. What did you do exactly?
dSpotter
OK, I got to the part where it says no proccesses left.

When I type in "service mysql start", it says " bash: service: command not found"?

What is the best way to reboot the server then?

Well all I was trying to do was setup an account and I got that error message about it not connecting. So when I check the server status it showed that mysql was RED (down). And ever since then I have been trying to get it back up icon_sad.gif
Erwin
Try this:

/etc/rc.d/init.d/mysqld start
/etc/rc.d/init.d/mysql start

If that doesn't work, you can run

reboot

on the command line, or use CPanel to do a Graceful Reboot.
dSpotter
How long does it normally take to reboot?

I just checked a second ago on the server status and the following are RED (down):

apache
exim
mysql

icon_sad.gif
Erwin
Server status is always a couple of minutes behind. icon_smile.gif Be patient - don't keep restarting them, as they may already have restarted. Best guide is to check your online pages. The fact that you can see CPanel means the server has rebooted successfully. Just wait for server status to catch up.
dSpotter
It's back up, thank you! icon_biggrin.gif

Now in the "Show MySQL Processes"

I have the following message rolleyes.gif :

/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

I got that when I just tried setting up a new account a second ago rolleyes.gif :confused:
Erwin
QUOTE
Originally posted by dSpotter
It's back up, thank you! icon_biggrin.gif  

Now in the "Show MySQL Processes"

I have the following message rolleyes.gif :  

/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

I got that when I just tried setting up a new account a second ago rolleyes.gif :confused:


Go to CPanel, click on SET MySQL ROOT Password, enter a password. Then, do what you were doing before, but this time enter your root password.

You can also create another user, and add them to the database you want to create.
dSpotter
QUOTE
Originally posted by Erwin
Go to CPanel, click on SET MySQL ROOT Password, enter a password. Then, do what you were doing before, but this time enter your root password.

You can also create another user, and add them to the database you want to create.


HHm... when I try to reset the password I get the following message:

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

:confused:
dSpotter
Still stumped on this one... I keep getting this when I try to setup an account.
Erwin
QUOTE
Originally posted by dSpotter
HHm... when I try to reset the password I get the following message:

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

:confused:


In that case, in WHM, scroll further down, and choose RESET MySQL Root password. Then try again. It should work.
technoart
Your symlink may be broken... try stopping all mysql process, then recreate the link, as so:

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

Then restart mysql...
dSpotter
QUOTE
Originally posted by Erwin
In that case, in WHM, scroll further down, and choose RESET MySQL Root password. Then try again. It should work.


This is what it says when I try to RESET it in WHM:

Waiting for mysql to restart.....030427 6:51:39 Can't start server: Bind on TCP/IP port: Address already in use
030427 6:51:39 Do you already have another mysqld server running on port: 3306 ?
030427 6:51:39 Aborting

030427 6:51:39 /usr/sbin/mysqld: Shutdown Complete

Done
Changing Password....ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'
Done
Reloading Mysqld...
Done
Attempting to restart mysql
Waiting for mysql to restart....
.
.
.
.
.
.
.
.
.
.
finished.
dSpotter
QUOTE
Originally posted by technoart
Your symlink may be broken... try stopping all mysql process, then recreate the link, as so:

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

Then restart mysql...


This is what it says when I type that:

root@spot [/home/admin]# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
ln: `/tmp/mysql.sock': File exists


I then preceded to restart mysql and I still continue to get that:

/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

icon_sad.gif
technoart
You did setup a password for MySQL, didn't you?

By default on a fresh Cpanel install, MySQL has NO password set for "root". So, until you set a password (via WHM) you can't login using a password (because a password hasn't been set).

If from SSH, if you type in

ps ax|grep mysqld

and you see a list of processes, then

type this

mysql -u root

and see if you can get in without a password.

If so, the password isn't set (yet)...

If so,

In WHM
Under "Server Setup"
--> Set MySQL Root Password
dSpotter
QUOTE
Originally posted by technoart
You did setup a password for MySQL, didn't you?

By default on a fresh Cpanel install, MySQL has NO password set for "root". So, until you set a password (via WHM) you can't login using a password (because a password hasn't been set).

If from SSH, if you type in

ps ax|grep mysqld

and you see a list of processes, then

type this

mysql -u root

and see if you can get in without a password.

If so, the password isn't set (yet)...

If so,

In WHM
Under "Server Setup"
--> Set MySQL Root Password


This is what I got when I typed in what you said:

root@spot [/]# ps ax|grep mysqld
13581 ? S 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql
13604 ? S 0:00 [mysqld]
13606 ? S 0:00 [mysqld]
13607 ? S 0:00 [mysqld]
13608 ? S 0:00 [mysqld]
13609 ? S 0:00 [mysqld]
13610 ? S 0:00 [mysqld]
13611 ? S 0:00 [mysqld]
13612 ? S 0:00 [mysqld]
13613 ? S 0:00 [mysqld]
13614 ? S 0:00 [mysqld]
root@spot [/]# mysql -u root
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

I did originally set a password when I first set it up. Didn't realize it was going to cause this much problems. icon_sad.gif

How would I go about fixing this?

TIA

Derrick Lane
technoart
If you type in...
mysql -u root

You get this?

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

I can see how if you typed...
mysql -u root -p

you'd get that response,
but without the "-p", you should get
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)

anyway, check and see if after typing...
mysql -u root -p

if you can login with your password
dSpotter
QUOTE
Originally posted by technoart
If you type in...
mysql -u root

You get this?

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

I can see how if you typed...
mysql -u root [b]-p


you'd get that response,  
but without the "-p", you should get  
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)

anyway, check and see if after typing...
mysql -u root -p

if you can login with your password [/B]


I had copy and paste exactly as I had typed it in my program. :confused:

When I tried doing "mysql -u root -p" and entered my password I got that error again... :confused: mad.gif

Below is exactly how it was on my screen after doing that:
QUOTE
root@spot [/]# mysql -u root -p
Enter password:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
ThaPhantom
look at mysql.com you need to reset the password... dont ask me why, but I have had to do it a few times when converting ensim to cPanel icon_smile.gif
Erwin
Reset the Password in CPanel. icon_smile.gif Remember, it's the 2nd link, which is near the bottom. It works.
dSpotter
QUOTE
look at mysql.com you need to reset the password... dont ask me why, but I have had to do it a few times when converting ensim to cPanel icon_smile.gif


Could you tell me exactly how you did it? I'm a newbie icon_razz.gif

I found this page on mysql.com about resetting the password.

The page is: http://www.mysql.com/doc/en/Resetting_permissions.html

I think I'm doing something wrong, because its not working.


QUOTE
Reset the Password in CPanel. icon_smile.gif Remember, it's the 2nd link, which is near the bottom. It works.


CPanel? I couldn't find a password reset for mysql in there? Or are you referring to WHM? I have already tried multiple times to reset the password in there and I still get:

Changing Password....ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

icon_sad.gif
Erwin
Yeah, I mean WHM.

Are you sure you are RESETTING the password, not changing it? Reset should override any previous passwords. If not, then something else is going on.
dSpotter
QUOTE
Originally posted by Erwin
Yeah, I mean WHM.

Are you sure you are RESETTING the password, not changing it? Reset should override any previous passwords. If not, then something else is going on.


Below is picture of what I was trying to do to reset the password. Is that the correct one?
dSpotter
I'm still learning here... please forgive me for probably asking a simple question but what exactly is the command I would type for below?:

QUOTE
Restart mysqld with the --skip-grant-tables option.
dSpotter
Ok all is well and its working great now. icon_biggrin.gif

This is what I had to do to get it back working again:

-Login as root

-Stop MYSQL server

/etc/rc.d/init.d/mysql stop

-Restart safe_mysqld with the skip-grant-tables

/usr/bin/safe_mysqld -Sg &

-Start MySql as root

mysql -u root -p mysql

-Hit enter when it asks for password

-Set a new password for root

update user set password=password("new_password") where user='root';

flush privileges;

quit

-Then restart mysql

/sbin/service mysql restart


Thanks everybody for your help!
Mike1984
I am getting this error to.

Mike1984
Mike1984
Fixed my prob.

Thank you,
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.