Web Hosting Talk







View Full Version : Cpanel mySQL???


HTTPbit
11-29-2002, 05:27 AM
Hello,

I am getting following error in Cpanels, activate on all domains of my Server:

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


SQL Disk Usage
---------------------
/usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)' Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists! du: `/var/lib/mysqldinsold_dinsold': No such file or directory du: `/var/lib/mysqldinsold_php': No such file or directory du: `/var/lib/mysqldinsold_xmb1': No such file or directory 0.00 Megabytes


Also site having mySQL database are not working, showing error message that "MySQL Server has gone".

When I try to restart MySQL server under my WHM, it shows that Server is OK.

Can anybody help me?

Thanks.

Shikha

skelley1
11-29-2002, 05:32 AM
don't know if this link will help, but it might:

http://www.mysql.com/doc/en/Can_not_connect_to_server.html

HTTPbit
11-29-2002, 07:22 AM
Thanks skelley1,

This is really helpful link. Now I am unable to restart the MySQL server from WHM. Everytime I try, it fails to restart. I am not getting what is the problem and how to solve?

Thanks.

Shikha

deadserious
11-29-2002, 07:23 AM
does var/lib/mysql/mysql.sock' exist?

skelley1
11-29-2002, 07:28 AM
can you restart from SSH?

deadserious
11-29-2002, 07:56 AM
You can try :D

Maybe try:

/path/to/mysql/bin/mysql.server stop
/path/to/mysql/bin/mysql.server start

Good luck!

HTTPbit
11-29-2002, 08:58 AM
does var/lib/mysql/mysql.sock' exist?



Sorry, I don't know how to check this. Can you please help me?


can you restart from SSH?




Please tell me how to restart from SSH?

HTTPbit
11-29-2002, 01:37 PM
The following is the line comes in SSH session, /var/lib/mysql/

srwxrwxrwx 1 mysql mysql 0 Nov 29 12:09 mysql.sock=

I think the problem is that Size of file is 0.

Any help please?

Thanks.

Shikha

deadserious
11-29-2002, 08:54 PM
Sorry I'm no mysql guru, but you could try

locate mysql.sock

to see if it even exists or if it's in the correct location

Maybe you could try restarting all the services.... maybe restart cpanel?

or reboot the server maybe?

And if your lucky that just might work. If not maybe someone else will help you out.

Good luck!

NickDev
11-29-2002, 09:50 PM
login to SSH and type


/sbin/service mysqld start

if that doesnt work try

/sbin/reboot


gl contact me if it doesnt work

HTTPbit
11-30-2002, 08:22 AM
/sbin/service mysqld start



root@dns1 [~]# /sbin/service mysqld start
mysqld: unrecognized service



if that doesnt work try

/sbin/reboot

root@dns1 [~]# /sbin/reboot

Broadcast message from root (ttyp0) (Sat Nov 30 07:21:54 2002):

The system is going down for reboot NOW!


Now, nothing is happening. HTTP, POP3 etc. are down now. What should I do? :bawling:

Shikha

nozol
11-30-2002, 08:42 AM
Do not panic, the server is just restarting.

After the server starts and you get ssh access to it, try doing the following.

login using ssh and su to root

cd /tmp

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

/etc/rc.d/init.d/mysqld restart

Hope this helps.

HTTPbit
11-30-2002, 08:44 AM
how much time Server takes to restart?

SSH is also not working, now.

Thanks.

Shikha

nozol
11-30-2002, 08:47 AM
It may take 15-30 minutes depending on the fsck work time. It may take longer, if so try contacting your data center and tell them that you restarted the server and it did not come back yet.

HTTPbit
11-30-2002, 08:48 AM
what does 'fsck work time' means? can you please explain me?

thanks alot

Shikha

nozol
11-30-2002, 08:53 AM
fsck is a utility that checks the hard disk for bad sectors and other errors. When the server restarts, it checks automatically. So depending on the time it akes to check the entire hard disk, the boot time will vary accordingly.

If your data center people have console access to the server, they can abort fsck work, so the server boots quicker.

HTTPbit
11-30-2002, 08:59 AM
fsck is a utility that checks the hard disk for bad sectors and other errors. When the server restarts, it checks automatically. So depending on the time it akes to check the entire hard disk, the boot time will vary accordingly.



thanks alot for your detailed explaination on topic.


If your data center people have console access to the server, they can abort fsck work, so the server boots quicker


I think, they must have. I have opened a Support ticket and waiting for their reply. Let see how much time it will take to answer the ticket & restarting the Server.

still waiting....

Shikha

HTTPbit
11-30-2002, 09:47 AM
Its almost one & half-hour & Server is still offline. Already submitted ticket but no reply. Is there anything else, I can do? Please help me.

Thanks.

Shikha

nozol
11-30-2002, 09:50 AM
Unfortunately, you have nothing to do, just wait for the support people to reply. If they have a phone number, you may try to call them.

NickDev
11-30-2002, 10:19 AM
Did you recently Edit Anything on your server?

HTTPbit
11-30-2002, 10:23 AM
Was my decision to reboot the Server right? Should not I try any other alternative to correct the MySQL problem?

Shikha

NickDev
11-30-2002, 10:25 AM
/sbin/service mysqld status

wiill tell you if Mysql is running

HTTPbit
11-30-2002, 10:27 AM
Did you recently Edit Anything on your server?



As far I remember No, I have not edited anything. Infact Server is giving problems since 2 days. Since yesterday this MySQL server problem occuring. Our providers are also unable to solve the mySQL problem, than they said that, they have told Cpanel.net to solve this problem, but it is 24 hrs 7 nothing happends.

Then we tried the command for reboot as suggested in another post.

Shikha

nozol
11-30-2002, 10:27 AM
In my humple opinion, rebooting a server is always a risk, you never know what will happen, so it is always the very last option to do.

Well, let's not mourn over the spilled milk, hope that the support people reply soon.

Wish you all the best!

HTTPbit
11-30-2002, 10:28 AM
/sbin/service mysqld status

wiill tell you if Mysql is running



Server is down or in reboot process. How can I execute this command. SSH also not working.

Shikha

NickDev
11-30-2002, 10:48 AM
Who did you get server from? URL?

HTTPbit
11-30-2002, 11:05 AM
Who did you get server from? URL?



Due to some reasons, we don't want to disclose this. I have you don't mind.

Thanks.

Shikha

nozol
11-30-2002, 07:45 PM
Did they reply yet? Did they solve your problem?

HTTPbit
12-01-2002, 12:56 PM
The Server is now working but the MySQL problem is as it is. Nothing happen. They told that Cpanel.net is working on the issue and they as well as Cpanel.net don't know yet what has happend to mySQL.

Shikha

nozol
12-01-2002, 04:28 PM
The error message says that some files do not exist, could you please check if this file exist for example

/var/lib/mysqldinsold_dinsold

by doing

ls -l /var/lib/mysqldinsold_dinsold

HTTPbit
12-02-2002, 12:36 PM
Hello,

Following is the result:

root@dns1 [~]# ls -l /var/lib/mysqldinsold_dinsold
/bin/ls: /var/lib/mysqldinsold_dinsold: No such file or directory

What should I do now?

Thanks for your continuous support.

Shikha

sasha
12-02-2002, 01:38 PM
Originally posted by Shikha
Hello,

Following is the result:

root@dns1 [~]# ls -l /var/lib/mysqldinsold_dinsold
/bin/ls: /var/lib/mysqldinsold_dinsold: No such file or directory

Shikha

/me guessing /var/lib/mysqldinsold_dinsold is irelevant on its own. dinsold_dinsold could be just a database in /var/lib/mysql/. This could indicate that mysql can not find its data dir. Something could be boken in init.d/mysql... or /etc/my.conf if it exists.

Try to start it manualy and see what happens
http://www.mysql.com/doc/en/Starting_server.html

dbbrock1
12-02-2002, 03:43 PM
Let me guess, your running freeBSD?

nozol
12-02-2002, 05:12 PM
Originally posted by Shikha
Hello,

Following is the result:

root@dns1 [~]# ls -l /var/lib/mysqldinsold_dinsold
/bin/ls: /var/lib/mysqldinsold_dinsold: No such file or directory

What should I do now?

Thanks for your continuous support.

Shikha

You are most welcome. I am just trying to help.

Ok, here is another suggestion, if it is not too much work to do.

login to ssh

stop mysql
/etc/init.d/mysql stop

create my.cnf file
pico /etc/my.cnf

put the following in the file

[mysqld]
datadir=/home/mysql

save and exit

move the mysql directory to /home/mysql

mv /var/lib/mysql /home/

start mysql
/etc/init.d/mysql start

Hope this works for you. If it did not work just move back mysql to its location

mv /home/mysql /var/lib/

change my.cnf file

[mysqld]
datadir=/var/lib/mysql

then restart mysql

/etc/init.d/mysql restart

Please let me know if it worked.

TheVoice
12-02-2002, 06:23 PM
this may sound stupid but did you set the mysql root password?

HTTPbit
12-03-2002, 02:09 AM
Let me guess, your running freeBSD?


Red Hat Linux 7.3


this may sound stupid but did you set the mysql root password?


Yes, we did at the time of Server setup.

Shikha

HTTPbit
12-03-2002, 02:32 AM
put the following in the file

[mysqld]
datadir=/home/mysql

save and exit



First I got blank file & I put the above 2 lines then tried to exit but unable to do, so I disconnected the SSH session & then login to SSH again tried to execute pico command & found that the file already contain the following lines

[mysqld]
set-variable = max_connections=500
set-variable = max_allowed_packet=8M

What does that mean & where should I place the above 2 lines before or after these lines.

Thanks.

Shikha

nozol
12-03-2002, 06:56 AM
If the file already exists, then just place one line

datadir=/home/mysql

just after

[mysqld]



This file is the configuration file of mysql. The settings you see set some restriction on the connection to mysql, so that it does not overload the server.

What we are trying to do with my steps is to move the mysql directory to another location in case there is a corruption in the current location.

Darth
12-03-2002, 11:04 AM
Shikha, are you on a redhat system?

HTTPbit
12-03-2002, 01:02 PM
Shikha, are you on a redhat system?



Yes, having Red Hat 7.3.

Shikha

Darth
12-03-2002, 03:08 PM
Use the rpm install feature to reinstall mysql ;)

HTTPbit
12-04-2002, 05:58 AM
Use the rpm install feature to reinstall mysql


You mean to say, first we should uninstall the MySQL & then reinstall it. I am not sure byt this way mySQL databases presently on Server remain or will be deleted. Can you please tell me.

Thanks.

Shikha

HTTPbit
12-05-2002, 08:29 AM
Hello nozol,

I tried the above solution but unable to solve the problem. Its still there.

By the way received following reply from DarkORB,


> root@dns1 [~]# /scripts/restartsrv mysql

I restarted it via the following commands:

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

>From there, it appeared to start just fine. Please try to connect to MySQL and let me know if you are still not able to.


I don't know how they are restarted the mySQL, I am unable to do so and connection to mySQL are failing as usual.

Shikha

nozol
12-05-2002, 08:35 AM
does it give the same error now or a different one? could you please post the new error message?

HTTPbit
12-05-2002, 08:54 AM
Same error.

Following is the error message comes when I access any of my website page having mySQL connection strings.


Warning: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (12) in /home/myusername/public_html/netFunction.php on line 122

Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (12) in /home/myusername/public_html/netFunction.php on line 122

Warning: MySQL: A link to the server could not be established in /home/myusername/public_html/netFunction.php on line 122
An error occured in the logger. Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (12)


Shikha

nozol
12-05-2002, 09:12 AM
Is mysql now in /home/mysql?

If so, please see if there is a file

/home/mysql/mysql.sock

If it exists, then

cd /var/lib/

mkdir mysql

cd mysql

ln -s /home/mysql/mysql.sock mysql.sock

/etc/init.d/mysql restart

then try to connect again, and let see this time.

Darth
12-05-2002, 10:06 AM
Originally posted by Shikha


You mean to say, first we should uninstall the MySQL & then reinstall it. I am not sure byt this way mySQL databases presently on Server remain or will be deleted. Can you please tell me.

Thanks.

Shikha

1. login to whm
2. find Software
3. click Install an RPM
4. scroll down until you can see mysql

;)

HTTPbit
12-06-2002, 12:04 PM
Is mysql now in /home/mysql?


Yes.


If so, please see if there is a file

/home/mysql/mysql.sock


Yes, this file is there.

srwxrwxrwx 1 mysql mysql 0 Dec 6 10:55 /home/mysql/mysql.sock=


If it exists, then

cd /var/lib/

mkdir mysql

cd mysql

ln -s /home/mysql/mysql.sock mysql.sock

/etc/init.d/mysql restart

then try to connect again, and let see this time.


root@dns1 [/var/lib/mysql]# Starting mysqld daemon with databases from /home/mysql
021206 11:04:30 mysqld ended

No, it is not starting. Please tell me, should I remove the following line from the my.cnf:

datadir=/home/mysql


Shikha

sasha
12-06-2002, 01:29 PM
chown -R mysql:mysql /home/mysl/mysql

This thread is gettin bit annoying. You managed to get yourself from simple problem it to the mess. You should spent some money and get someone who knows how to fix things.

nozol
12-06-2002, 02:38 PM
Yes, as sasha said

chown -R mysql:mysql /home/mysql

did you also make a link

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

?

HTTPbit
12-07-2002, 06:40 AM
Thanks nozol for your help. Today, we ordered the company to setup the Server from scratch, as they were unable to solve the problem & we also.

Ok, sasha I am not going to put any other post to this thread. This is my last post.

Shikha

nozol
12-07-2002, 06:43 AM
Originally posted by Shikha
Thanks nozol for your help. Today, we ordered the company to setup the Server from scratch, as they were unable to solve the problem & we also.

Ok, sasha I am not going to put any other post to this thread. This is my last post.

Shikha


I hope they solve it soon, I know how you feel, it is realy frustrating for any web host.

And sorry I could not help, wish you the very best of luck!

sasha
12-07-2002, 09:01 AM
Originally posted by Shikha
Thanks nozol for your help. Today, we ordered the company to setup the Server from scratch, as they were unable to solve the problem & we also.

Ok, sasha I am not going to put any other post to this thread. This is my last post.

Shikha

There, now I feel bad. I have no right to say someone what to post here.

Getting outside company was a good idea.