The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Which file to backup?

Discussion in 'Database Discussions' started by Benchelt, Apr 21, 2010.

  1. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    I am trying to repair the database for my site and i am using the files from an earlier backup - but do i use a data base file or a .sql file?

    Thanks in advance

    Ben
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Your message is not very clear ...

    Are you asking what files to restore?

    to run the repair against? to backup?

    If your database is corrupted, I would try using phpMyAdmin to copy the database and run repair routines against the original tables.

    You can shutdown MySQL and copy the files from ~mysql/ if you want to keep an untouched copy of the MySQL database.

    You can try doing an SQL dump but if you are dealing with corruption as it sounds like you are talking about, a database dump may not build properly and might have missing data.
     
  3. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Hi there

    The menu from my site is missing and i am told

    'you need to re-insert the menu code which will look like INSERT INTO `menu` '

    I dont understand this so i am trying to repair the database table? with a backup i made last week. I have now set up the old database in MySQL and I am trying to link this to my website - with little success. lol

    Thanks in advance

    Ben
     
  4. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Changing database

    Hi there

    I have a database that has missing files and i have a backup ready to replace it. How do i do this? - do i have to dump the old database first or can i overwrite it with the new one.
    Cpanel restore was a waste of time and so i am trying to do this manually.

    Thanks

    Ben
     
  5. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    You may simply use the mysql command from SSH to replace the old database.

    Code:
    mysql -u[username] -p[password] database < backup.sql
     
  6. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    Why not to get the tables only for your menu of the MySQL database and restore to your live database without affecting the rest of the record?
     
  7. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,477
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    All you need to do now is edit the config file for this site to point to the restored db.
     
  8. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Edit config file

    Thanks for your help

    Where would i find my config file to change. I am also using a custom made CMS. Would i only have to change the config file?

    Cheers,

    Ben
     
  9. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    That varies from script program to script program and really depends on the script you are using with your web site but generally will have "config" in the name like "config.php", "config.local.php", "configure.php", "config.inc", etc.

    Another tip off to the correct file is it will usually have "localhost" in the file as the name of the database server
     
  10. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Path

    Hi there

    So if i find this file i should be able to edit the file path that points to the database. It cant be that simple? lol.

    Ben
     
  11. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Database blues

    Hi there

    I have a database with tables missing so i have created a new database with a backup of the old one before it went west.
    I am trying to link this new database to my site and cant work it out.
    I have been advised to run repair routines against the original tables but i cant work out how to do this.
    The navigation is missing from my site and the developer has just said
    "you need to re-insert the menu code which will look like INSERT INTO `menu` ....."
    :confused:
     
  12. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Cpanel administrators ---
    looks like this post should be merged with this members other thread (duplicate posting ).

    Benchelt:

    This post makes a hell of a lot more sense than your other thread where everyone is really scratching their heads because you didn't communicate clearly but with this post I think I follow a bit better what is going on.

    Basically in a nutshell, your developer is telling you to merge the data from your old original database with the new database by making an SQL dump of the old database (gives you a text file with a lot of INSERT commands) and then running that SQL file against the new database to update the new database with the information saved from the old database. The idea clearly being to repair your database and missing tables by using the new database as a template.

    At this point, the assumption made by the developer and everyone else at this point is that you have already done a "mysqldump" of your original database? This is what you'll need to do to proceed with what your developer was trying to tell you to do.
     
  13. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for all your help

    Thanks. - i finally sorted it after being given enough information from this forum to do it myself.
    I simply replaced the database with the backup in php myadmin.
    Gutted all my SEO work is gone but at least i dont have to worry my boss in marbella.
    Nice one

    Ben:)
     
  14. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    You posted the same topic and question n 3 different threads so makes it a little difficult to follow your posts ----

    Per what I said in the other thread, you need to do a repair of your old mysql database followed by a mysqldump.

    Setup your new database to work with your script by editing the scripts configuration files to point to the new database (presumably already loaded)

    You would then run the SQL file generated from the old database dump against the new database which you could do from phpMyAdmin or from the SSH shell by specifying the new database name in the parameters when starting MySQL or put adding "USE dbname;" to the top of the SQL file where "dbname" is the name of the new database.
     
  15. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Thought i was home and dry

    Thanks for your reply

    It did seem to work and my site is up and running but the CMS wont let me update the pages - only the SEO (gutted)
    It's custom-made so i think i might have to source a developer.
    Spent the whole doing the SEO bits and bobs. To make things worse i started with this company last week and they fell out with the developers 2 days earlier lol.

    Cheers

    Ben:confused:
     
  16. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,477
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Moderator note: 3 threads have been merged into one topic.
     
  17. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Hi there

    I opened up the database i wanted to repair & highlighted all the structure boxes, then 'operations' and 'copy database to' and entered in the new database. It then copied all the missing tables and my sites navigation now works.
    The problem i now have is that it seems something did not go across as my CMS wont let me update the pages as I get loads of error messages.
    A lot of the advice is over my head - is there anyone who knows what I am on about and what i need to do?

    Thanks in advance,

    Ben
     
  18. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,477
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    There is really no way that anyone here could help you, you've not mentioned the actual scripts you're running for the site. Either way, this isn't actually a problem with your cPanel.

    You'll do better to ask your host for assistance, or the script developers.
     
  19. Benchelt

    Benchelt Member

    Joined:
    Apr 6, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Hi there

    This is one of the error messages. Is this also script info?

    Warning: fopen(../about.php) [function.fopen]: failed to open stream: Permission denied in /home/centrals/private/includes/edit_pages.php on line 422

    Thanks in advance

    Ben
     
  20. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,477
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Yes.

    Seems like permissions are set wrong on a file. Your host can help you fix that, too.
     
Loading...

Share This Page