Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


Need Help Installing: Duplicate entry '1' for key 'PRIMARY'

edited November 2010 in Questions
I installed Vanilla 2 successfully and imported my Vanilla 1 forum successfully. Everything was well and good until I accidentally changed the Vanilla 2 install root folder name. Ever since that happened I was unable to access my site. I tried naming it back but it just gave me errors.

I deleted everything on my server so I could start fresh. I put Vanilla 2 back on the server and tried a fresh reinstall. Now I receive this error every time after I access the installer on my browser and submit my info, trying to install it.

Here's the error. Please let me know if you have a solution.


-------------


Fatal Error in Gdn_Database.Query();
Duplicate entry '1' for key 'PRIMARY'
update GDN_User User set Name = :Name, Password = md5(:Password), Email = :Email, ShowEmail = :ShowEmail, Gender = :Gender, DateOfBirth = :DateOfBirth, DateFirstVisit = :DateFirstVisit, DateLastActive = :DateLastActive, DateInserted = :DateInserted, DateUpdated = :DateUpdated, Admin = :Admin, UserID = :UserID
The error occurred on or near: /usr/local/apache2/htdocs/wcom/vanilla/library/database/class.database.php

* Method: Query

Comments

  • cdavidcdavid New
    edited October 2010
    You most likely point your new install to the old database which already has a User with UserID = 1 (the one that creates the forum), therefore the error.

    To fix it, login to MySQL (I prefer terminal, but anything will do),
    $ mysql -u __your_user__ -p
    select the proper database
    use __DB_Name__
    and issue:
    DELETE FROM GDN_User WHERE UserID = 1; which deletes the user which has ID 1.

    And then try to reinstall normally.

    /cd
  • Computer science engineer roomie just helped me. Had me delete my old databases via phpmyadmin. It worked!

    Thanks for the help though david.
  • Well, either you delete the entire database or just the primary user. In any case, glad you succeeded. Welcome to Vanilla.

    /cd
  • I have the same problem here but I don;t understand the solution. Can someone please help.
  • TimTim Lord of Servers Vanilla Staff
    Vanilla tries to create a new user with User ID '1' when it is installed. This is somewhat legacy behavior, but that's just the way things are. If you point Vanilla's Setup script at a database that has already had Vanilla installed to it before, there will already be a user with UserID = 1, so Vanilla will be unable to install there.

    Solution (as presented by @cdavid):

    Run the following query on your database (either through PhpMyAdmin or some other tool):
    DELETE FROM GDN_User WHERE UserID = 1;
    If you do not understand this, you need someone to actually guide you through the process, and that is not within the scope of this forum (unless some kind user decides to do it for you).

    Vanilla Forums Senior Developer [GitHub, Twitter, About.me]

  • Did that now getting this:


    Fatal error: Class 'CategoryModel' not found in /home/safinn/public_html/forum/applications/vanilla/settings/structure.php on line 62


    :( any idea?
Sign In or Register to comment.