Restoring MySQL databases from files.

Discussion in 'General' started by dimas, Dec 16, 2010.

  1. dimas

    dimas Member

    I have a few questions I sincerely hope you'll help me with.

    I had a hard disk crash on one of my servers running ISPConfig. I can't boot it. But having attached this hard disk to another computer I saw that most of the files are intact.

    So I did a fresh install of ISPConfig 2.2.37 on a new hard disk drive (debian 5.0.7, perfect setup) and tried to manually restore some sites I didn't have fresh backups for.

    Of course it went well with the files inside web/ but when it came to MySQL...

    Well, that's what I did. I made a new db via the panel, and then copied the contents of /var/lib/mysql/old_db from the crashed disk to the corresponding /var/lib/mysql/new_db on the freshly installed server.

    Then I changed permissions of all these .frm .myd .myi files to 660 (I didn't touch the directory) and changed ownership to mysql:mysql (which are the default permissions - as I can see looking at the other "naturally" created databases).

    Then I rebooted and tried to load the site. Well, it didn't load, with MySQL error 1017, ER_FILE_NOT_FOUND

    This made this thinking that something is still wrong with the permissions.

    And indeed, when I chmodded the contents of /var/lib/mysql/new_db to 755, the site was finally up and running, seemingly without any problems.

    So, my questions are:

    1. Are 755 permissions inside /var/lib/mysql/ somehow compromising the server's security?
    2. What is keeping MySQL from seeing the copied files, taking into account the fact that they have ABSOLUTELY the same permissions (user, group, read-write-execute rights)? Is there some other "subtle" permission layer?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    1) I think 755 is ok.

    2) Which table type do the database tables have? Myisam or innodb? Are you bale to see the database tables in phpmyadmin when you login as root?
  3. dimas

    dimas Member

    Thank you for your reply.

    After I chmodded the files to 755 I could see the database tables in phpmyadmin when I logged in as the database user.

    I can't check it as root now because something weird is happening with the server. I don't believe it's somehow connected to the yesterday's mysql experiments, though.

    At the moment booting takes ages and I get "lockfile creation failed" error.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Check if the harrdisk is not full and if the harrdisk is mounted in read/write mode. You can check for boot errors with the command:

  5. dimas

    dimas Member

    At the moment I can't get as far as login prompt, and there's no response over SSH.

    The hard-disk is brand-new and has lots of free space.

    Also, yesterday I rebooted the system multiple times and all was OK. Actually, I rebooted it last night before going to sleep (all was OK) and some time in the course of the night it became acting weirdly.

    By the way - this situation probably justifies another topic, because right now I've noticed that my second Debian Lenny ISPConfig server (same configuration - ISPConfig 2.2.37, perfect setup, but totally diffrent hardware and even ISP) is also experiencing something similar. But I haven't done a thing to it for a few weeks at least!

    When I saw that the services on this second server were down, I rebooted and it now takes ages to boot. At the moment it hangs for about 10 minutes at "Starting ISPConfig System..." but no errors yet.

    I'm really at a loss now.

    Could it be that some automatic update kills off Debian Lenny ISPConfig servers?
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig has no automatic update functions. Also if this would be something that affects all ispconfiug 2 installs, then we would have seen here probably a few hundred posts on that as here. I run some ispconfig lenny servers on my own and they dont have any problems.

    So if its a problem with a automatic update, then it must be something that you configured on your system outside of ispconfig.
  7. dimas

    dimas Member

    Yes of course I realize that, and it's very strange. In fact, this second server has finally managed to boot fully, but it's painfully slow now and the services are not responding.

    And I get the same type of errors as on the first server, namely:

    task clamscan: 2492 blocked for more than 120 seconds
    task apache2: 3350 blocked for more than 120 seconds

    dmesg on this second server shows no errors that I can see.

    All I did to the configuration over last few weeks was to

    apt-get install libwww-perl

    because spamassasin wasn't working, as explained here:

    Other than that it's 100% exact "perfect setup".

    I don't think it's a hardware or Internet problem, because, as I said, the servers are totally different and have different ISP providers.

    I'll try to find out what it is and post the outcome here - however right now I don't know where to start.
  8. Captain

    Captain Member

    For security reasons /var/lib/mysql chmod will be 700


Share This Page