• Resolved joergpe

    (@joergpe)


    I am using one WP site ‘Calendar’ as normal MyCalendar host and a second site ‘client’ as read-only view of the calendar, option “Get data (events, categories and locations) from a remote database” is enabled.

    I add some demo events, with name and date and location,
    Everything works as expected.

    But when I add 42 or more events the View on Calendar is ok, but the Client site is broken with error establishing a databse connection.

    When I delete one event everything is ok again.

    When I delete the location in every event everything is ok again.

    I turned on WP Debug and got a lot of error messages like this:

    And this message at the end of the page:

    ==My Calendar:==
    Version: 3.4.17
    DB Version: 3.4.17
    ==WordPress:==
    Version: 6.3
    ==Extra info:==
    PHP Version: 7.4.33
    DB Version: 8.0.34

    I really need the remote feature. Can you please look into this?
    Yours Jörg

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    The warning about having more than max_user_connections is coming from the MySQL set up, and isn’t something I can do anything about. This is most likely set by your host, and you’ll need to communicate with them about changing that. The MySQL instructions are here: https://dev.mysql.com/doc/refman/8.0/en/user-resources.html, but those are unlikely to be something you can change yourself.

    Thread Starter joergpe

    (@joergpe)

    Please note: when I remove the location of the events, the warnings and the error “establishing a database connection is gone”.
    So I think the SQL statements that selects the location produces an error and the SQL connection is not closed correctly and is running out of connections.

    I use a server wih 300 max_user_connections that should be enough.

    And the error occures with 42 or more events in the list so if I have more max_user_connections I will run into the error later with e.g. 200 entries.

    Please give this problem a look, the cool feature “remote DB” is not usable like this.

    Thread Starter joergpe

    (@joergpe)

    The max_connection error is in include/db.php line 135.
    Every request to the remote database opens a new connection to the remote database. Here is a fix:

    function mc_is_remote_db() {
    global $wpdb;
    global $remotedb;
    $mcdb = $wpdb;

    if ( ‘true’ === mc_get_option( ‘remote’ ) && function_exists( ‘mc_remote_db’ ) ) {
    if ( !isset( $remotedb ) ) {
    $remotedb = mc_remote_db();
    }

    $mcdb = $remotedb;
    }
    return $mcdb;
    }

    The Warning can be removed in my-calendar-locations.php line 203

    if ( ! $post_id && isset($mcdb->postmeta) ) {

    Would be nice if you can push this in next Version!

    Plugin Author Joe Dolson

    (@joedolson)

    Thanks! I saw you also opened a Github issue, so I’m going to close this; but it’ll make it into a near future release.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘MySQL error using MC with remote database’ is closed to new replies.