multi db not working

I have tried to use localhost and my IP addy and both cases give me the same error after i hit copy in step 4.

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 124

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 124

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 124

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 124

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 124

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 124

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 125

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 141

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/revamped/public_html/communitysitesforrealestate.com/wp-content/scripts/move-blogs.php on line 140

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /move-blogs.php on line 141
  • thinkmarketact

    after reading another thread from 2008 it says when the script works correctly it can still throw up a couple of errors.
    https://premium.wpmudev.org/forums/topic/error-i-move-blogsphp-on-line-107-108-122-123#post-4780

    so i created a bunch of dummy blogs and it looks like i have new tables wp_4 in database 2 and wp_6 in database 4 etc etc

    by that im assuming it is working.... is there anything else i need to check for?
    is there anything else i need to know? like the global database is probably for plugins that are used on all sites? so if i install a plugin that i active on a per blog basis where does that go? global or in the individual tables for that blog? and how does it get there? does it just go there or do i have to put it there?

    and finally, this was a test site on a new domain so now i have to bring it over to the real WPMU site which is days away from launch.
    All Plugins are set up with different values that default
    there there are about 50 blogs on it. the main one, a couple i set up for tutorial purposes and maybe 30 beta sites that clients are using to help test this out for me.

    do i just install multi db on the existing site or wipe it clean and start over again..... :slight_frown:

  • DavidM

    Hi thinkmarketact,

    It does sound like everything got setup properly at this point.

    For the most part, everything should just work from here, you generally wouldn't have to make any changes for plugins to work.

    There are particular cases, like with the Supporter plugin, where there are a couple things you'd have to add to the db-config.php file, but these things are all mentioned on the respective installation pages for those plugins.

    I'm going to mention this thread to a couple of the other guys around here who have more experience with Multi-DB to be sure we've got your questions covered.

    Thanks,
    David

  • thinkmarketact

    this is to late for me but could help the next guy....

    it would have been great if there was instructions on how to use shell access to assign a username to each of the databases if you are on cpanel and use sql to create all the databaes.

    side note - when you use sql to create the 256 databases they do not show up in cpanel - you have to do some mapping which took a while to figure out.

  • Mason

    Hiya thinkmarketact,

    You're right the instructions could use with a bit of an update (you should have seen the previous version). Creating the databases and assigning the username via ssh is the best approach, but it's pretty advanced for most folks.

    As to the global database, any plugin that adds a global table should be added to the array in db.php before plugin installation.

    side note - when you use sql to create the 256 databases they do not show up in cpanel - you have to do some mapping which took a while to figure out.

    yeah, that is a limitation of cPanel, but if you add them as root you can see them in cPanel and they should be available in phpMyAdmin regardless.

  • Mason

    Hiya,

    I tested this with 16 databases and it seemed like new blogs would go in to a random DB

    it's actually calculated by the last couple characters of the MD5 Sum of the blog ID. So if the blog id is 2 and the md5 of 2 is c81e728d9d4c2f636f067f89cc14862c

    for 16 dbs the tables will be in databaseprefix_c
    for 256 dbs the tables will be in databaseprefix_c8
    for 4096 dbs the tables will be in databaseprefix_c81

    i have 256 databases now and it looks like all new blogs are being put in the same database?

    That's very possible. If you originally installed 16 databases there's no 'upgrade' path to add it to 256 or 4096. You should just do the install once with the amount of databases you wish to install. I'd recommend re-installing

    Thanks!

  • thinkmarketact

    wt3 also creates a db.php file and it over wrote your db.php file.

    when i have the w3t one in there and go to move blogs it says

    table name table info new db status
    wp_33_commentmeta blog33 sites_newmulti_18 exists table in new db

    and when i go to db 18 the tables for blog 33 are there.

    when i create a new blog though the move-blogs.php status says "table not in new db"

    so new blogs are not being sent to their seperate databases

    when i put in your db.php file in to wp-contents the status of most blogs says "table not in new db" ? all blogs go back to twenty 11 and i can not copy anything over via move blogs?

  • thinkmarketact

    after playing around with this I THINK it is working fine but i just have a big mess

    when i put in db.php from your plugin nothing works right on my site but i think that is just because your plugin is pulling from a db that has old information. information from BEFORE i added the w3t plugin. which over wrote your db file and screwed everything up

    best way to fix?

    can i delete the tables from all of the 256 databases? and re copy everything with move-blogs?

    what about global can i just delete the tables there too?

    or do i have to delete all the databases and start from scratch?

    this is assuming move blogs COPIES the tables and not MOVES them from the main database to 1 of the 256 databases

    more digging....

    i currently have the w3t db.php file in wp-contents and everything is fine so does that mean the 256 + global database isnt even being used? if so i can just delete the tables of all those databases and confirm the settings in db-config.php and re run move-blogs.php

  • thinkmarketact

    more digging...

    i deleted blog 33 from database 18 since it was in the main database as well. blog 33 still worked perfectly.

    i then went back to move-blog.php and it said blog 33 was not in the new DB and i hit copy and it copied over.

    this is still with the w3t db.php file in there and not yours.

    so the move-blogs portion is working

    i then deleted blog 33 from the main database and i ended up with a database connection error.

    so the tables are moving but the blog is not using the copied database? im assuming this is because i have the wrong db.php file in there?

    when i put your db.php file in everything is old so this just confirms your script is working but what do i do to get your db.php file to use the newer information?

  • Barry

    It sounds like the following happened -
    1. You created the databases and used move-blogs to populate the databases with the correct tables.
    2. You left the original tables in the original db, which was the db that is configured in your wp-config.php file

    At this point with the multi-db's db.php in place the system is pulling the information from the correct databases. When W3 Total cache was installed, it overwrote the db.php and your multi-db was effectively disabled and the system went back to using the original database connected via your wp-config.php. It was only because you had the original tables still there that you didn't initially notice.

    When you then overwrote the db.php with the multi-db one again, the system went back to using the multi-db system, but it was now out of date.

    At this point the best approach would be to remove all the tables from your multi-db databases and restart with move-blogs.php.

    Avoid using W3 Total cache.

    I also tend to change the wp-config.php information to point at my global database and away from the original database.

  • thinkmarketact

    Sorry for the multiple posts but I wanted to try to eliminate the back and forth and just get an answer like you gave above.

    So to confirm...

    delete the TABLES from all of NEW databases i created with your sql tool ( the 256 + global)

    this SHOULDN'T break any sites because all data is in the original database.

    2. You left the original tables in the original db, which was the db that is configured in your wp-config.php file

    AKA i messed up correct? They should be in global right?

    And this controlled with in db-config.php line 25 right?

    //------------------------------------------------------------------------//
    //	Do not include default global tables
    //	Leave off base prefix (eg: wp_)
    //
    //	Usage: add_global_table(TABLE_NAME)
    //	EX: add_global_table('something');
    add_global_table('database_GLOBAL');
    ??

    so double check that line again do the copy-blogs script one more time

    and then change the main wp-config.p[hp file to point to the global database

  • Barry

    AKA i messed up correct? They should be in global right?

    No, I sometimes leave mine in the old database as well, it's a nice backup - but in this case it hid the fact that the system fell back to that single db, so i switch the db config in the wp-config.php file to point to the global db so the system can't access the old tables at all.

    add_global_table('database_GLOBAL');

    If you have a table called database_global in your global database then yes, otherwise that lines going to generate a lot of errors.

  • Mark de Scande

    @Barry Just a idea why not offer only this plug with a installation voucher and upgrade voucher and charging a small fee to set this up for most users BUT always have a If i mess up your DB it is your problem.

    I have Multi-DB 16 DB setup and i also got some of the errs in this post when i first added it to the BlogLines.co.za system so it is not one of those drop it and rock with it plugs.

    Guys if you trying to add Multi-DB try to do it on a fresh install of wordpress it just works easy like that but if you were like me that had a 10Gb DB and then go over to Multi-DB it gets tricky :slight_smile:

    Still with this plug if you do it right it rock.

    @Barry if your ever in the mood write a plug to test the setup after install and then give the user a report to say it was done 100% I know my biggest problem was how do i know if it all works.

  • thinkmarketact

    My multi db is working fine now, thanks for the replies!!

    besides w3t cache is there any other plugins that create a db.php file? and is the db file created with a script or would i see it if i unzipped a plugin folder?

    now since i cant use w3t i have quick cache on all blogs, i think i will be adding the php cache as well is it APC to the server...

    is there any other plugins that should be used for speed that just work for multi site?

    i was using amazon simple storage with w3t but since i cant use w3t how else can i seamlessly add simple storage? any good plugins out there?

    you can close this with your next reply.

    thanks
    again

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.