Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default add prefix to database

    Can I add a database prefix to an already installed and configured shop? What is the easiest and fastest way to do it?

    I have 195 tables so renaming it manually is a suicide... I've tried running zc_install again and choose database upgrade, but when i click "upgrade db now" i get a white screen and all it says is
    Code:
    in:
    [SHOW TABLES]
    and no change is done to the database.

    Also, I can't use addon "database table prefix changer" since it only changes the prefix and i don't have a prefix.

    Is there a way to do it from phpmyadmin?

    And, yes, I know of all the problems i could (and probably will) have, but i really need to do this.

    Edit:
    Forgot... ZenCart 1.3.8a, PHP 5.2.6, MySQL 5.0.67-community, still on localhost using xampp
    Last edited by balihr; 9 Nov 2009 at 09:52 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: add prefix to database

    Is there any compelling reason why you want to add a prefix?

    if you are loading another APP into the same dbase, just give the new app a prefix.
    20 years a Zencart User

  3. #3
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: add prefix to database

    Here's the whole story:

    I've installed zencart almost a year ago and in the meantime have done a lot of modifications. Let's call it Shop1.
    Now, I want to open another shop (Shop2) on the same domain but in a different folder. The shop would use a different template. So, I downloaded Shop1 and DB1 to my computer in order to make a new one. Shop2 using DB2 is now fully functional and would like to upload it to go live.

    I want to add a prefix to DB2 and then merge it with DB1 so that both shops could use the same database, but different tables. After that, I would change some lines in database_tables.php from Shop2 and remove the prefix so that Shop1 and Shop2 will use SAME customer details. Basically, I want to share customer details between the two shops and this seems like a good idea... This might be a sollution to my earlier post here

    If there's a better solution to my problem, please do let me know.

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: add prefix to database

    This will actually cause problems...

    The principle behind prefixes is cheifly to allow one database to host two independent sets of data.

    Prefixes mean de facto that you have TWO databases, housed in a single "shell".

    You are proposing to (later) "blend" the tables and hence the data, but I don't think you have factored in the very taxing question of ID references that are used for RELATIONAL purposes and AUTO INCREMENTS that give a particular data record its unique referencing point.

    You will have (in each "database") data that will have the same ID's as data in the other database - but the information that ID refers to will be very different.

    When you come to "blending" the data, there can be no duplication of ID's across the relational functionality. MySQL will not allow this to happen anyway, so unless you have a couple of centuries of spare time to manually re-configure all the ID's (and make sure their cross-referencing is 100% accurate as well), then abandon this quest now...
    20 years a Zencart User

  5. #5
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: add prefix to database

    Look in the free add-ons for the multisite mod... It's a more realistic method of doing what you propose. It uses ONE database, with ONE set of data.
    20 years a Zencart User

  6. #6
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: add prefix to database

    Oh, yeah, well, I'm simply an expert when it comes to mysql... Thank you for saving me both time and sanity...

    So, do you have ANY idea how to do what I want? Because, I don't think I'm asking for much - I just want a customer from shop1 to be able to use the same login on shop2 and not go through the whole process of writing user details again. Is this really such a big problem?

  7. #7
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: add prefix to database

    multisite mod...
    20 years a Zencart User

  8. #8
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,740
    Plugin Contributions
    22

    Default Re: add prefix to database

    Are you sure?

    I've read the entire thread and as I understand it requires two different domains or IPs. Did you try to use it with only folders on the same domain or maybe know for a fact it works?

  9. #9
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,266
    Plugin Contributions
    3

    Default Re: add prefix to database

    I've not used it, but just looked at what's been said about it. I have no idea if it is suitable for you or not, or whether it is reliable. I just know that it exists and that it presents an opportunity to run several "different" webshops off one database... which is close to where you are coming from.
    20 years a Zencart User

 

 

Similar Threads

  1. Add a prefix to database tables
    By hyperlite635 in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 13 Oct 2007, 10:32 PM
  2. Database Prefix
    By Erica in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 22 Jul 2007, 09:43 AM
  3. Add database prefix...
    By Alex Clarke in forum General Questions
    Replies: 5
    Last Post: 9 Aug 2006, 09:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg