Error establishing a database connection


Every time I try to BULK SMUSH photos (1450) after 4-8 photos optimised I get this error / this bulk smush kills my database.

Would be nice to get this sorted.

I'm with bluehost


  • Dimitris

    Hey there Mantas,

    hope you're doing good and thanks for reaching us! :slight_smile:

    This seems a rather weird error to occur upon smushing images... :thinking:

    Did the bulk smush action work before and now started to have this issue? Or did you just start using Smush?

    Could you please try to deactivate all other plugins, revert to default TwentySixteen theme and test again? If this resolve this issue, start enabling your theme and plugins one-by-one, testing each time by bulk-smushing, until you've got the conflicted combination.

    If this comes down to nothing, some additional debug information may become handy to us.
    Could you please access your server through FTP, edit the wp-config.php file, find a line like
    define('WP_DEBUG', false);
    and replace it with the following (if the above line doesn’t exist, simply insert next snippet just above the /*That’s it! Stop editing… */ comment)

    // Enable WP_DEBUG mode
    define('WP_DEBUG', true);
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);

    Then go ahead and try to replicate the error. By doing so, a /wp-content/debug.log file should be created. Simply download it, rename it to debug.txt and attach it here in your next reply.

    Warm regards,

    PS. Did you, by any chance, contact Bluehost support about this issue? Feel free to do so in case this is something from the server side and please share any feedback you may have.

  • Dimitris

    Hey there Mantas,

    I'm glad you were able to narrow this down! :slight_smile:

    I didn't know this plugin but a simple Google search showed me that the plugin isn't currently available in repo ( and there's also a recent vulnerability which doesn't seem to have been sorted out (
    If this is indeed the reason for this, I'd propose you to delete it and find an alternative. :wink:

    Warm regards,

  • Dimitris

    Hey there,

    But I have new issue with WP-Optimize plug i, if this plug-in is activated your smush does't work, it simply don't move. I have to deactivate and it works again.

    I wasn't able to replicate this in my test installation so far... :thinking:
    Could you please grant us with support access to your website via our "WPMUDEV Dashboard" plugin, in order to inspect your settings and try to reproduce this one more time?
    You can find detailed information about granting us support access here

    Warm regards,

  • Adam Czajczyk

    Hello Mantas!

    I tested WP Optimize with WP Smush Pro on my sandbox setup but I wasn't able to replicate that too. Since you haven't granted us an access yet I'm afraid we'll need to wait until you do this so we could check the settings of your site and then give it another shot while trying to replicate your environment as closely as possible. Let me know please after you grant an access.

    Can you also explain one thing? I super-smushed all my photos but google page speed test show's that my photos are not optimised? How this possible ?

    This is possible and there are two factors here:

    1. Google is using algorithms that are known to them only and we (nor anybody else) do not have any way to make sure that our algorithms much theirs. Therefore there may occur some cases of such reports regarding some of the images;

    2. The WP Smush Pro plugin can optimize images that are stored in your Media Library and, if you got it installed, in NextGen Gallery folders. It cannot however optimize images that are:
    - stored in external locations
    - stored in other places than Media Library by some other plugins (that's rare issue but happens in case of some gallery plugins other than NextGen)
    - part of the plugin/theme - stored in them/plugins folder

    The latter is most likely the reason for that Gogole report. PageSpeed Tool engine analyze an entire page including images that are part of the layout. WP Smush Pro doesn't affect them. To deal with this images it would be best to "optimize" them manually. There's also a link on PageSpeed tool in image optimization results section of the report ("Optimize images") that will let you download optimized versions of these images. You can then simply replace images in theme's folders with their "Google optimized" versions.

    One last thing is the structure of the theme. Google takes into account the way the image is displayed. For example: the image that's used in a theme can be displayed as "800x600 pixels" image because the "img" tab "width" and "height" attributes are set to these values and/or it's resized using CSS. In case the real dimensions of an image doesn't match that size, PageSpeed Tools may also report that these images are not optimized. That's however the matter of how the theme is build.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.