Fedora Linux Support Community & Resources Center
  #1  
Old 31st May 2006, 06:35 PM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
How to recover mysql

So, could somody be so kind to help me to recover my database, pls.

'FC5, mysql-5.1'

Well, I had 1 root, 1 user
user had right to insert, ...,
sometimes from root i granted that user to 'all'
and that user dropped the 'mysl' datebase
right after I reinstalled mysql & mysql-server
did not helped,

then I erased every "mysql*", "./mysql"
after I reinstalled mysql & mysql-server
user remained but all databases lost
some error, like:
Can't connect to local MySQL server through socket '/var/lib /mysql/mysql.sock' or something lie that appears anytime

Do you have any solution?
Thks
Reply With Quote
  #2  
Old 31st May 2006, 06:52 PM
landoncz Offline
Registered User
 
Join Date: Dec 2005
Location: Florida, USA
Age: 35
Posts: 338
can't connect to local server is different than can't select a database. It appears that your mysql daemon is not running. Does the command:
Code:
ps -ef|grep mysqld
output anything? If not, then you need to start your daemon...
Code:
/etc/init.d/mysqld start
as root
__________________
Fedora Core 6 on Asus Z63A 14" Laptop
2.0 Ghz Pentium M
1 Gig RAM
100 Gig 7200 RPM

Code:
# rm -rf /dev/brain
Reply With Quote
  #3  
Old 31st May 2006, 06:54 PM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
NO it is running...
Reply With Quote
  #4  
Old 1st June 2006, 09:39 AM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
OK, exactly:
1.
ps -ef|grep mysqld:
ptszaboo 2727 2543 0 10:32 pts/2 00:00:00 grep mysqld


./etc/init.d/mysqld start
2.a as user
touch: cannot touch `/var/log/mysqld.log': assess denied
chown: `mysql:mysql': invalid user
chmod: `/var/log/mysqld.log' assess change: assess denied
2.b as root
chown: `mysql:mysql': invalid user

So, this is the case.
Reply With Quote
  #5  
Old 1st June 2006, 09:41 AM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
And from promt:
# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Reply With Quote
  #6  
Old 1st June 2006, 09:51 AM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
/var/log/mysqld.log:

060601 10:45:29 mysqld started
060601 10:45:29 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
060601 10:45:29 [ERROR] Aborting
060601 10:45:29 [Note] /usr/libexec/mysqld: Shutdown complete
060601 10:45:29 mysqld ended
Reply With Quote
  #7  
Old 1st June 2006, 09:53 AM
pete_1967 Online
Clueless in a Cuckooland
 
Join Date: Mar 2006
Location: Here now, elsewhere tomorrow.
Posts: 4,303
You need to check that user and group mysql exist, if not, you have to create them, or alternatively change mysql to run as another user.
Reply With Quote
  #8  
Old 1st June 2006, 09:56 AM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
Ok, msql group is exists, and on.
mysql user not exists
Reply With Quote
  #9  
Old 1st June 2006, 03:08 PM
landoncz Offline
Registered User
 
Join Date: Dec 2005
Location: Florida, USA
Age: 35
Posts: 338
Quote:
Originally Posted by ptsz
OK, exactly:
1.
ps -ef|grep mysqld:
ptszaboo 2727 2543 0 10:32 pts/2 00:00:00 grep mysqld


./etc/init.d/mysqld start
2.a as user
touch: cannot touch `/var/log/mysqld.log': assess denied
chown: `mysql:mysql': invalid user
chmod: `/var/log/mysqld.log' assess change: assess denied
2.b as root
chown: `mysql:mysql': invalid user

So, this is the case.
Actually if the above output is actually what you got from your grep of mysqld, then mysql was NOT running, as it only printed out your grep of mysqld. Here is an example from my machine of what it should print out when it is running:
Code:
[landon@fedora ~]$ ps -ef|grep mysqld
root      1892     1  0 May31 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --log-error=/var/log/mysqld.log
mysql     1928  1892  0 May31 ?        00:00:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
landon   13261 13238  0 09:07 pts/2    00:00:00 grep mysqld
[landon@fedora ~]$
But of course like pete said, you also need to make sure you have the user and group 'mysql'...
__________________
Fedora Core 6 on Asus Z63A 14" Laptop
2.0 Ghz Pentium M
1 Gig RAM
100 Gig 7200 RPM

Code:
# rm -rf /dev/brain
Reply With Quote
  #10  
Old 2nd June 2006, 06:00 AM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
Understand, I am newbie in linux, and very newbie in mysql...
Ok, I was wrong, I thought it was running because it was supposed to run,,,,
By the end I reinstall all Mysql,
It said, no mysql user, and use as root user..
Now as user: ps -ef|grep mysqld
"ptszaboo 2431 2284 0 06:55 pts/3 00:00:00 grep mysqld"
as root:
"root 2450 2438 0 06:56 pts/3 00:00:00 grep mysqld"

It works now, thanks a lot.
How can I reset that config as yours?
Reply With Quote
  #11  
Old 2nd June 2006, 06:33 AM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
Ok the previpous was my second failure:
mysql deamon was off,
i started it manually, and
NOW :
[ptszaboo@Pentium4 ~]$ ps -ef|grep mysqld
root 3257 2438 0 07:24 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --user=root
root 3297 3257 0 07:24 ? 00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=root --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
ptszaboo 3480 3429 0 07:30 pts/4 00:00:00 grep mysqld

It seems to be similar to yours, isn't?
Reply With Quote
  #12  
Old 2nd June 2006, 02:39 PM
landoncz Offline
Registered User
 
Join Date: Dec 2005
Location: Florida, USA
Age: 35
Posts: 338
It is no problem, we were all newbies at one time or another...

Yep, looks like you've got it running ok, now can you connect? Or do you still get the connection errors? Try something like:
Code:
mysql -u root
and see if it lets you in or gives you an error...

Also, if you want to have the daemon startup automatically, open up your services configuration (system-config-services as root or from the menu), and select the mysqld service to start at boot and save your changes... You may have already done that though
__________________
Fedora Core 6 on Asus Z63A 14" Laptop
2.0 Ghz Pentium M
1 Gig RAM
100 Gig 7200 RPM

Code:
# rm -rf /dev/brain

Last edited by landoncz; 2nd June 2006 at 02:42 PM.
Reply With Quote
  #13  
Old 2nd June 2006, 03:29 PM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
Well
I knew about auto sevices starting. BUT
If I it set to start auto, I got errors.
And right now I got error, when I tried to start it manually:
060602 16:08:08 mysqld started
060602 16:08:08 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!

060602 16:08:08 [ERROR] Aborting

060602 16:08:08 [Note] /usr/libexec/mysqld: Shutdown complete

I dont understand , 6 Hours ago I worked with my database ....
????????
Reply With Quote
  #14  
Old 2nd June 2006, 03:48 PM
ptsz Offline
Registered User
 
Join Date: Mar 2006
Posts: 62
Well after a while I found one solution for the problem:
I create mysql user, AND add write permission to
/var/run/mysqld folder
It seems to be good.
[root@webboy ptszaboo]# ps -ef|grep mysqld
root 7952 1 0 16:45 pts/3 00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid --log-error=/var/log/mysqld.log
mysql 7988 7952 0 16:45 pts/3 00:00:00 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
root 8048 4380 0 16:48 pts/3 00:00:00 grep mysqld
[root@webboy ptszaboo]#
Thanks
Reply With Quote
  #15  
Old 2nd June 2006, 03:51 PM
SHtRO Offline
Registered User
 
Join Date: Jul 2005
Posts: 178
You have hosed your installation. You might try backing up your database directory. Uninstall mysqld. Reinstall it from RPM's (which should handle setting up the users/groups, etc.). Then you can try restoring your DB directory, since the DB version should be the same.

You apparently deleted something extra when you were trying to clean up. Now your DB has difficulty starting and cannot interact properly.

Backup, Uninstall, and Reinstall. Then be more careful about what you delete. Make prolific use of 'rpm -q' to find out what is required and what is not (see "man rpm"). Also do a bunch of reading on MySQL administration. There are innumerable articles and tutorials on the 'net that are current.

But the real thrust here is to do your homework before deleting files and setting perms on your system. Considering you are a newbie, you might want to review some security HOWTO's as well.

Maybe someone else has in their mind some concise commands for the ops mentioned above...

Best of luck.
__________________
Imagination is more important than knowledge.
--Albert Einstein
Reply With Quote
Reply

Tags
mysql, recover

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't recover FC4 zabolots Using Fedora 2 5th December 2005 11:39 AM
MySQL: Can't open privilege tables: Incorrect information in file: './mysql/host.frm' benjamin.choi Servers & Networking 1 25th June 2005 04:19 PM
Install mail server from Postfix/CyrusSASL2/PAM-MySQL/MySQL/Dovecot/Amavisd/Clamav chengcsw Guides & Solutions (No Questions) 7 26th April 2005 08:38 PM
help me recover!! cuchumino Using Fedora 11 20th September 2004 07:07 PM


Current GMT-time: 02:26 (Saturday, 30-08-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat