Help me copy a Drupal install for local sandbox testing
June 27, 2008 3:28 PM   Subscribe

I'm having some trouble recreating a Drupal site on my local machine for testing/sandbox purposes. The mysql databases are the biggest stumbling block at the moment - very basic, beginner advice is probably needed.

Short into: I took on a freelance project to redesign a site that's currently built in Drupal, which I've never used. It was my intent to nuke the current site & rebuild a static site, as Drupal is serious overkill for what this site needs. However, it turns out the client is well attached to some of the current features (the video management tool in particular, but also the "news story" updates & such). Since I don't know Drupal at all, I declined to attempt a site update without extensive testing first, and proceeded to try & recreate the site on my home machine. I have installed Apache 2.2, PHP 5.0, Drupal 6.2 & MySQL 5.0 successfully, and all four appear to be working.

Here's the current problem - I have no idea how to get the source databases working with my installation. I backed up the databases via the online control panel, but I've just realized that what I have are backup files, not the actual DBs. Attempting a restore via MySQL Administrator tells me "The selected file was generated by mysqldump and cannot be restored by this application." I'm obviously in way over my head - I've done a variety of work in php & the like, but I've never been responsible for setting up or maintaining databases, so I might have bitten off more than I can chew here.

Questions: can what I'm trying to do here actually be done? That is, will it be possible to essentially mirror the original website on my localhost so I can learn without blowing up the live site? Would it be better to create new local databases & attempt to recreate the site that way? Or should I stop wasting my time and just nuke the sucker in favor of a simple, static site?

I'll be working on this all weekend, so any and all questions can be addressed. E-mail's in the profile if needed.
posted by Banky_Edwards to Computers & Internet (7 answers total) 2 users marked this as a favorite
Use the command line:
  1. CD to a directory that contains your dumpfile.
  2. mysql -u root --password=111 name_of_db_to_create <>
You'll then want to configure your Drupal instance to connect to the database with username/password/etc.
posted by rhizome at 3:47 PM on June 27, 2008

looks like rhizome's command got eaten by the parser.

i don't think this autocreates a database, so you may need to manually create one from the command line (using 'create database db_name;'). then simply:

mysql -uroot -pyourpass name_of_database < database_file.sql

but yeah, essentially the answer is yes.

my opinion on static sites is that it is a *rare* case where a static site makes more sense than one built with a CMS.
posted by fishfucker at 3:55 PM on June 27, 2008

hah, funny. There's a difference between preview and post!

And yeah, aside from having to do security updates from time to time ($$ in your pocket anyway), having a CMS makes a lot more sense in the long run.
posted by rhizome at 5:35 PM on June 27, 2008

Thanks gentlemen - that was exactly what I needed to get past this roadblock. I got the backup dumped into the new, local db - huzzah! Now Drupal says "could not select database." Looks like it will be a looong night no matter what.

I'm not going to come back here with every snag I hit, but if either of you - or anyone else who pops in here - has any experience with what I'm trying to do (recreate a Drupal-managed site on a local server) and can give me a heads-up regarding issues I'm likely to run into, any and all advice would be much appreciated.

And fishfucker, I'm not disagreeing with your preference for CMS, I just don't have a lot of experience working with them, let alone setting them up. I'm just one dude trying to make people's sites look slick for short money. And I'll take a static site that looks good over one with a bitchin' CMS back-end and a ghetto front-end any day!
posted by Banky_Edwards at 6:00 PM on June 27, 2008

I've worked with several sites in Drupal and have migrated from my local dev server and back. I like Drupal a lot but be prepared for a bit of a slog if this is your first go-around with it.

Generally, I use PHPMyAdmin for interacting with the database, but command-line works if that's all you have.

This is generally what I do:
1. Dump the database from the site I am copying.
2. Install Drupal clean in the target directory
3. Copy anything from the modules, files, and themes directories that are not part of Drupal core
4. Go into PHPMyAdmin or mysql and drop all the tables in the database, but don't delete the database
5. Import the dump into the new database
6. Go back to Drupal and run update.php, which will update the database -- I don't remember encountering that particular message, but I would try this and see if that helps. The version your client currently is running is almost certainly not 6.2, so updating is essential

If your trying to recreate a site that was done in Drupal 5 or earlier, you'll want to make sure that all of the installed modules have versions that work with 6.X. Unfortunately, there are a some modules that aren't yet ported to 6, others whose functionality has been added to the core and are therefore redundant, and others whose functions have been integrated into other modules.

Also unfortunate is the fact that there's not really an easy way to check for these, you just have to go to, look up the module, and look at the latest version. (Drupal 6 is much better about updates to modules, but unless you're going from an earlier 6 to 6.2, then this will be an issue.
posted by camcgee at 6:59 PM on June 27, 2008 [1 favorite]

Wow, camcgee...My test site is a total mess, but for the first time since I started this cursed project, I'm loading content from the database! Hopefully it's more or less a matter of cleaning up the broken configs & settings. There's definitely loads more work to do, but the wall has been breached! Thanks so much for the simple step-by-step - that's exactly what I needed to get rolling again.
posted by Banky_Edwards at 7:42 PM on June 27, 2008

Wow, camcgee...My test site is a total mess
To speed up certain operations, Drupal caches the location of various theme and plugin files; depending on where you put your test site it may be looking for them in old locations. Try visiting /admin/build/modules and /admin/build/themes -- hitting those administration screens causes it to rescan the filesystem and update its cached paths. You may see the site 'magically' start looking good again. ;-)

Also be on the lookout for places where a previous designer might have put hard-coded references to images at particular URLs that aren't there when you're running on your local site.
posted by verb at 12:54 PM on June 28, 2008

« Older Help me get my son a good education!   |   What kind of plant is this? Newer »
This thread is closed to new comments.