#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    4
    Rep Power
    0

    Question Database Location On Host's Server and/or Within Website's Folder


    Hi all,

    I am doing some cleanup and updating to a website. We moved it to a different hosting company several months ago and the person who moved the site uploaded (via FTP) all of our site's folders and files, including a folder that contained our databases.

    He also created "new" databases through the new host's database control panel. He simply "Added" a new database and then uploaded all the corresponding .CSV files.

    We immediately noticed errors on any pages utilizing the databases.

    I went to work trying to figure out the problem and found that it was the "new" databases causing problems. I didn't know how or why they were the problem, and I didn't have time to dig deeper at that point. We just needed to "make it work".

    So I deleted the "new" databases and that solved the problem. Considering that all the connections, links and code remained unchanged, it made sense to me that it worked.

    Now that I am working exclusively on this project and have the time to address all issues thoroughly, I'd like to understand what's going on and make corrections, if necessary. So, I guess my question is:

    When migrating an entire database-driven website to a new hosting company, is it necessary to upload existing databases (or create new) via the hosting company's Database Control Panel, in my case, phpMyAdmin? Or are our databases fine where they are, in a folder relative to the rest of our site's folders and files, with the proper connections, links and code intact?

    Note-although our databases appear to be working fine, they are NOT listed or acknowledged in any way with our hosting company. It appears, in our Control Panel, as though we have no databases at all.

    We pay them annually and are allotted up to 6 sites and 5 databases (or something like that). And right now, it's showing that we are using 0/5 of our possible databases.

    I guess my concern is whether location of a database affects functionality (short AND long term) (assuming all links/connections are correct). I mean code is code is code, right? Does the phpMyAdmin Database Control Panel function purely as a tool of convenience for users whose websites contain databases OR does it serve some other purpose that I just am not seeing right now?

    This may not make sense-I'm hoping I've explained clearly.

    Thanks to any and all willing to help.
    Steph
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,275
    Rep Power
    9645
    You're using MySQL?

    The database isn't just the files that you have. I assume you're talking about *.frm and *.myd and *.myi files? Those are where the data is stored, but you need MySQL to know about and read them. Simply copying the files over won't work.
    Having the database files alongside your site files is highly unusual, and I'd be surprised if you found any other hosting company doing the same thing. So those files you have would need to be moved to the MySQL data location, which is not something you yourself can do in a shared hosting environment.

    If you're using the exact same version of MySQL as before, on the same architecture (ie, Linux/Windows, 32/64-bit, etc.) then you may be able to get away with creating the databases and tables in MySQL, stopping MySQL, overwriting the various files it created with your existing files, and restarting MySQL.
    But the most reliable way is to do a mysqldump from the old system with the old data, and feed the SQL it creates into MySQL. The SQL can have the statements to create databases and tables so you won't have to do that manually, but if you're using shared hosting then it won't be that simple. See this.

    So, first question: can you still access the old database to do a mysqldump?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    4
    Rep Power
    0
    Hello again requinix

    Okay, so I've never even heard of .frm, .myd or .myi files.

    Also (and I should have clarified) the databases are ms access (.mdb) files.

    As you know I'm transitioning from asp to php and I'm transitioning the db's as well (to MySQL).

    so does that change things? while I LOVE php, sort of HATE Microsoft, and want to use MySQL, it seems I cannot create an actual physical MySQL database (like I can with ms access). I know I can download MySQL, but even then, it is not the same thing. My thinking may be too concrete here to understand this but I do not understand a MySQL database.

    thanks
    s.
  6. #4
  7. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,275
    Rep Power
    9645
    Originally Posted by sbishops
    Okay, so I've never even heard of .frm, .myd or .myi files.

    Also (and I should have clarified) the databases are ms access (.mdb) files.
    Ah, that makes much more sense.

    Those three files I mentioned are MySQL's equivalent to Access's .mdb files: it's where the database actually lives as files.

    Originally Posted by sbishops
    As you know I'm transitioning from asp to php and I'm transitioning the db's as well (to MySQL).
    You overestimate my ability to recognize and remember usernames.

    Originally Posted by sbishops
    so does that change things? while I LOVE php, sort of HATE Microsoft, and want to use MySQL, it seems I cannot create an actual physical MySQL database (like I can with ms access). I know I can download MySQL, but even then, it is not the same thing. My thinking may be too concrete here to understand this but I do not understand a MySQL database.
    Yeah, that changes things quite a bit. Access uses plain files that you can pass between people like over email, which is a nice idea but it has quite poor performance in the real world. MySQL still has files, naturally, but those are files you're not supposed to actually interact with - your application connects to MySQL itself.

    Your best bet is probably to find some sort of free Access-to-MySQL software tool. Which I'm sure exists. The alternatives are a bit more hands-on, like needing to install drivers on your computer, or a bit more restrictive, like exporting data into CSV format and having MySQL load the data in (which doesn't work well for binary or large data).
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    196
    Rep Power
    17
    When I've moved a site, I copy the file structure, and do a database dump into a file.

    At the new location, I create the database and populate it by reading in the aforementioned database dump, edit the configuration in the site INI files, and test.

    There may be some dumbassery where the person who wrote the web site code hard-coded some DB configuration in a dumbassery way, but usually my approach works.

IMN logo majestic logo threadwatch logo seochat tools logo