d.b's picture

Hi all - 

I'm new to some of this this, trying to get a laptop built up w/ a working web site / CMS that I can take to client sites and do live demos of web sites being built. Running a laptop w/ Fedora 10 as host. Installed Turnkey drupal appliance. Going through some of the base configuration, and ran into what looks like is a database problem. I was going to make a copy of the database, and using the phpadmin interface I get an error when copying the 'users' table. It's complaining about a duplicate primary key. When this happened, I had indeed created a second user in the database, but it had a different uid from the 1st user (root), so I was not really able to tell what the problem was. . . . .. Rather than deleting that second user, I created a 2nd VM, this time w/ only one user, and I get the same error when I try and do a copy of the database.

I found a couple of recommendations, but wanted to post here and find out best solutions/approaches to this.

One recommendation involved using an add-in drupal module to do the copying rather than the phpadmin 'copy' a database option. I stumbled on this approach when I tried to add the 'guest additions' so that I could use a shared folder to get the module moved from the host to the guest.

Another recommendation approached it by using a different SQL query to 'insert' the copied records into the newly created database.  . something about the way the dump was auto generated had some extra lines in it that caused the final stages of the copy to fail.

Thanks in advance for the help. I like the idea of using a VM to host the web site, on the same physical box as the one I'm browsing from. I've been working on understanding this for a few days now, and I'm hoping to continue this learning process.

Thanks for the help . . . .

 

d.b      

Forum: 
d.b's picture

 Thought I'd add a few more details. . .

To copy the MySQL database, I'm launching phpMyAdmin. I select my drupal6 database (it reports there are 45 tables).

Under Operations, I selected 'Copy database to' - Structure and data, CREATE DATABASE before copying, and Switch to copied database are the checked selections.

Error:

MYSQL said:

#1062 - Duplicate key '1' for key 1

The copied database has 40 tables. . . . . .

 

Thanks in advance

d.b

alunr's picture

I know nothing of Drupal BUT take a look at the table design for the Drupal Users.

It sounds like the id field should be set to auto increment.

d.b's picture

alunr -  

Thanks for taking a look at this . . .  I checked the users table in the drupal database. It indeed is set to auto_increment . . . . . .. And in one of my test databases, even tough there are three entries, each does have a unique uid, (which is the primary key field that the copy is complaining about).

d.b 

Alon Swartz's picture

I'm not quiet sure I understand what you are trying to do, What do you mean by "making a copy of the database"?

Not sure if this is relevant, but I recently helped someone move his already built Drupal6 site to run on TurnKey Drupal6. When he came to me he was having trouble importing the database, due to duplicate entries. The solution was to use --add-drop-table when dumping the database, so it would import cleanly.

I hope the above helps, if not, can you please provide more information on what you are trying to accomplish.

Good luck.

d.b's picture

  . . .  .  learn the right way to do things.

And I appreciate your help with this. In a previous job I helped 'fill in the guts' for a content management system, so I'm a little familiar with CMS (it was Ektron CMS) - used a little Dreamweaver. But I did it under the direction of someone else.

I played around a little with web sites and html, used an automated site-builder pkg to make a basic website, but never got really involved with the nuts and bolts.

I've dabbled a little in Linux over the years but never really learned anything serious or used it for anything really interesting.

I run a small business (IT consulting) and have had several clients ask about putting together web sites, and so thought this was a great time to use a Fedora laptop, add a CMS appliance as a guest OS, and be able to carry a laptop into a client's office and show them a couple of options for web sites and content management, all on a single standalone laptop. So, over the last week I've started to tweak out a Linux-based host laptop, added a drupal appliance using VirtualBox, and started to play around with the host/guest/webserver/browser all on one box.

As part of learning how this works, I've reviewed online documentation (the drupal_cookbook,pdf at http://drupal.org/files/drupal_cookbook_10_25_2008.pdf). In that documentation the author recommends setting up multiple websites within a single installation, and I thought, cool, that's something I should learn how to do. He recommends making a copy of the original, system created database by using the MySQL phpMyAdmin tool. But I got the error when I tried to do that. I'm (obviously) no database expert, but I'd like to learn why the problem cropped up, and it isn't obvious to me.

I don't really know what it means to be dumping the database ( I can hear you now -- arrrrgh, this guy really doesn't know MySql/databases.) I've noted some people talking about printing out the results of a dump of the database, I'm not sure how to do that. I browsed the database, did a couple of SQL queries, checked to make sure there were not two entries in the USERS table that had the same primary key.

Then I figured I'd ask the question.

I've got a couple of directions to go from here. Since all I want to do is get a database/webserver/browser demo going on a box, I'm thinking maybe the guts of the database copy doesn't matter. One alternative I have is to just make a copy of the whole VM as a 'backup' of my starting point.

I could also try Joomla instead of drupal. I've got both appliances installed and working on the Fedora-based laptop.

Regardless, I am chalking a lot of this up to experience, and feel like I am learning quite a bit to have gotten this much working thus far. Hope I haven't wasted your time with this rather lengthy explanation of what it is I'm trying to do . . . .

Perhaps you have some advice for this 'long-winded' 'jack of all trades and master of none'.

d.b 

Liraz Siri's picture

Don't be discouraged when things don't work the way you want right away. There's a learning curve to be climbed. Just experiment a lot and eventually via trial and error you'll figure things out. Being able to break things and then start over with few consequences is one of the great things about a self contained appliance. If you bork things up too badly just start fresh.

Hope this helps!

Add new comment