cancel
Showing results for 
Search instead for 
Did you mean: 

Mysql is broke!!!

jabb0
Grafter
Posts: 716
Registered: 18-09-2007

Mysql is broke!!!

hey guys,

As stated it broke...

error from phpmyadmin
Quote
The server is not responding (or the local MySQL server's socket is not correctly configured)


php-script error
Quote
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)


I have just setup linux on my box, well it took all weekend, mon, and today to figure the whole thing out.
My first thought was to uninstall mysql then re-install it... then i realised i dont have much of a clue as to what should and should not be removed from the system to achieve this without breaking anything else.

Any ideas?

It did work this morning, and i cannot recall doing anything with mysql, thats not so say it didnt happen, i just cant remember.
6 REPLIES
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Mysql is broke!!!

Does /var/run/mysqld/mysqld.sock actually exist?

In the mysql config file try using localhost.localdomain instead of just localhost as th host for MySQL.

Have you tried rebooting Linux to see if that fixes it?

I'm going to start charging for Linux support soon Wink
jabb0
Grafter
Posts: 716
Registered: 18-09-2007

Mysql is broke!!!

yeah the reboot was the first thing i tried, no luck.

No the /var/run/mysqld/ dir is completely empty.

Im looking for the mysql conf file at the mo.... where is it?

======================
A short while later
======================

I have managed to find a file in /etc/mysql/my.cnf
Now this file file references that nonextistant file in that empty dir - /var/run/mysqld/ - However there is no mention of a var set to localhost which i could change to localhost.localdomain.

Prolly in the wrong file... think ill leave this till the morn (if i wake that early)

======================
A short while later - again
======================

After a little more searching on the net, i thought trying to start the mysql server from command couldnt do any harm - so i did and got the following error message
Quote
050914 3:58:40 mysqld: Can't find file: './mysql/host.frm' (errno: 13)
050914 3:58:40 Fatal error: Can't open privilege tables: Can't find file: './my sql/host.frm' (errno: 13)
050914 3:58:40 Aborting

050914 3:58:40 mysqld: Shutdown Complete

Now i dont know about you but his just confuses me even more.

Should i be worried that it cannot find host.frm?
(or that .sock file for that matter?)

I also read that reinstalling the thing will not help, ooo i am getting scared that i will have to reinstall Ubuntu - jus when i thought i had finnally succeeded.
But then again i also read that some guy got it fixed, although he never thought to mention how Cry

( Im guessing that @ 4:10am u has gone to bed - prolly not a bad idea )
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Mysql is broke!!!

Your mysql install / DB is bad and needs to be reinstalled. You should not need to reinstall Linux to fix it.

Find out how you can uninstall packages on your distro, find the MySQL package on the net that matches your distro and reinstall it again.

As I stated earlier, because your distro is not well know, when problems like this occur you will have difficulty finding solutions. With fedora core for instance, just 2 rpm commands would uninstall and reinstall mysql.

Also I gave you duff info before, I meant the phpmyadmin config file not the mysql one. But what you have posted sugegsts your mysql database is corrupted causing mysql to fail to start which in turn stops it creating the communication socket file which phpmyadmin (and other things like PHP) from connecting to your database.

Also if you have been playing with file and owner permissions you may have made some mysql file inaccessable to MySQL causing your problem. Errno 13 is permission denied so check the files listed have the correct permissions - they probably need to have an owner / group of mysql and have at least 755 perms. Be VERY VERY CAREFUL when doing recursive owner/group and permission changes!!!
jabb0
Grafter
Posts: 716
Registered: 18-09-2007

Mysql is broke!!!

Yip i slept on this.
Dammit ur good, i did indeed do a chmod on my MYSQL data dir, so i could copy the backed up data back into there.

This might be pathetic, but im gonna try reversing that change...

I have got Synaptic package manager, i installed mysql and php through the CLI, would an acceptable solution to reinstalling everything that say says mysql beside it in the package manager (or am i just playing russian roulette now?)

How long have you been usin and abusing penguins? (linux)

Assuming i miraculously get this all working again, is there a right way to restore mysql's data dir without breaking it?

Thanks for the help, im off to google mysql libs.
Community Veteran
Posts: 14,469
Registered: 30-07-2007

Mysql is broke!!!

Quote
Dammit ur good

That's what keep telling everyone but no-one is listening Wink (currently unemployed)

Quote
I did indeed do a chmod on my MYSQL data dir, so i could copy the backed up data back into there.

This might be pathetic, but im gonna try reversing that change...

In theory, that should be all you need to do. It's a permission problem causing this, not a db corruption as I first thought.

In the long term I think your backup method is what is causing you these problems. You should not copy MySQL directories of files but export the data into a backup sql file. phpMyAdmin has an option to do just that under the export tab (you export structure and data), or you can use mysqldump (look it up) from the command line (or do a search for mysqldump in this forum for examples of it's use).

Quote
I have got Synaptic package manager, i installed mysql and php through the CLI, would an acceptable solution to reinstalling everything that say says mysql beside it in the package manager (or am i just playing russian roulette now?)

As stated above just correcting the permissions should be all you need to do.

Quote
How long have you been usin and abusing penguins?

About 10 years (and linux a year or 2 less Wink)and 15 years doing UNIX before that.

Quote
Assuming i miraculously get this all working again, is there a right way to restore mysql's data dir without breaking it?

You don't copy/restore directories/files, you export/import the data to/frpm .sql files.

Have a look at phpmybackup. Very easy to use backup and restore php app.
jabb0
Grafter
Posts: 716
Registered: 18-09-2007

Mysql is broke!!!

Cheesy Cheesy Cheesy
Changed the permissions - restarted my box - woohoo.
Nice one, excellent.

POint about backup definitly well noted, it worked alright in wondoze, but its not the way to do things in linux.
Methinks i could be sayin that quite often in the near future.

Cheers for the help
Muchos Gratias