DB Error, could not list tables

Hello,

I operate a Wordpress Multisite network with ~5000 blogs and I'm trying to move from 1 DB to 16 using the Multi-DB plugin.

However, after having followed every step I run into an error while trying to launch /wp-content/scripts/move-blogs.php

The error is:

DB Error, could not list tables
Make sure you configure your original table in the dbname variable at the top of the script!
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-org' at line 1

I've searched for this error on this forum and saw that people had inputed errors in their move-blogs.php file.
But I'm almost 99% positive that I haven't.
But still, here are the lines 19-25 (I have blacked out the password, but I can assure you that is the right one)

In fact, I'm afraid that it must be because I already have too many tables... PhpMyAdmin can't even list them anymore.
When I login into PhpMyAdmin and try to access my main database I see the following error in the sidebar:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 82 bytes) in /var/www/localhost/htdocs/phpmyadmin/libraries/dbi/mysql.dbi.lib.php on line 224

Therefore my question is: If this is indeed because I have already too many tables... how could I ever launch Multi-DB?. Is this a Catch-22 situation?

Thank you!

  • aecnu

    Greetings Lancelot,

    Welcome to WPMU Dev!

    From looking at this specific error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 82 bytes) in /var/www/localhost/htdocs/phpmyadmin/libraries/dbi/mysql.dbi.lib.php on line 224

    Tells me that you do not have enough php memory to run phpmyadmin and possibly Multi DB neither.

    So the next thing to check is the phpinfo, specifically the lines that say:

    memory_limit

    max_execution_time

    If you do not have a phpinfo to check I have attached one in a zip file below and you would want to download it, unzip it, andupload just the phpinfo.php file up to the root of your website and then launch it in your browser. i.e. http://yourdomain.com/phpinfo.php

    Please advise concerning the two settings mentioned above.

    Cheers, Joe

  • aecnu

    Greetings Lancelot,

    If in fact you are on a dedicated server you may want to bump up the settings to the following in the php.ini file:

    memory_limit 512M

    max_execution_time 240

    To show that I practice what I preach:

    http://fab-host.com/phpinfo.php

    http://wpmu-hosting.org/phpinfo.php

    Please advise if you still get the same error after the adjustments and in addition please do not forget to reboot Apache after changing the php.ini file settings.

    Cheers, Joe

  • Lancelot

    Hey everyone,

    I have some very good news. After stumbling on some more problems I've finally been able to successfully transfer all of my tables (~46 000 apparently).

    Problem 1:

    DB Error, could not list tables
    Make sure you configure your original table in the dbname variable at the top of the script!
    MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-org' at line 1

    This happened while trying to launch move-blogs.php for the first time.

    My DB name had a dash in its name and this posed some sort of SQL syntax issue.
    The solution was to change in move-blogs.php the following line (19):

    $dbname = "mywebsite-org"; //This is your current database

    Into

    $dbname = "Xmywebsite-orgX"; //This is your current database

    Edit: Errr, can't post the right thing here.
    Replace the X with the following caracter: http://en.wikipedia.org/wiki/Grave_accent

    Problem 2:

    mysql_free_result() expects parameter 1 to be resource [...]

    This happened while trying to move the tables using move-blogs.php

    The solution was to commment, in move-blogs.php the lines 124, 125, 140, 141
    Ex:

    //mysql_free_result($sql_table);
    //mysql_free_result($insert_info);

    Problem 3:

    mysql_set_charset() expects parameter 2 to be resource, boolean given [...]

    This happened after the tables were moved. When login into dashboard or even visiting some of the blogs.

    The solution was to go back into db-config.php and instead of using the IPs, using localhost everywhere.

    Alright! If you stumbled onto this post using the search function, I hope these changes will work for you. However, keep in mind that these are hacks and may or may not work for you. The scripts and files were probably not intended to be used that way... but heh, it works.

    Again, thank you Aecnu for your support and Minglemooch for your offer.

    Cheers everyone :slight_smile:

    PS : Aecnu, could you please delete the entire quote in my first post where my DB details appear? Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.