This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: WordPress database error Lost connection to MySQL server during query for query... Solution: The client resolved the issue by moving the site to another host than GoDaddy

This topic contains 13 replies, has 2 voices.

Last updated by Brendan Cote 4 months, 3 weeks ago.

Assigned support staff: Bruno Kos.

Author Posts
May 19, 2019 at 4:50 pm #3842111

Brendan Cote

We are getting an sql error since 5:54pm on may 10th.

[10-May-2019 17:54:04 UTC] WordPress database error Lost connection to MySQL server during query for query
SELECT DISTINCT
s.id,
s.name,
s.context,
st.status,
s.gettext_context,
st.value AS tra,
st.mo_string AS mo_string,
s.value AS orig
FROM wp_icl_string_pages sp
INNER JOIN wp_icl_string_urls su
ON su.id = sp.url_id
INNER JOIN wp_icl_strings s
ON s.id = sp.string_id
LEFT JOIN wp_icl_string_translations st
ON s.id=st.string_id
AND st.language=su.language
AND s.language!=su.language
WHERE (su.language='en' and su.url='(.?.+?)(?:/([0-9]+))?/?$') or (su.language='en' and su.url IS NULL)
made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, arve_create_shortcodes, arve_get_options, arve_get_options_defaults, arve_get_host_properties, __, translate, apply_filters('gettext'), WP_Hook->apply_filters, call_user_func_array, icl_sw_filters_gettext, icl_translate, WPML_Register_String_Filter->translate_by_name_and_context, WPML_Displayed_String_Filter->get_translation, WPML_ST_DB_Cache->get_translation, WPML_ST_Page_Translations_Cached_Persist->get_translations_for_page, WPML_ST_Page_Translations_Persist->get_translations_for_page

This prevents the site from loading.

I have disactivated string translations and the site is available, but obviously I need string translations to function.

May 20, 2019 at 7:49 am #3844425

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

Before we investigate this issue further, could you make sure your server conforms to our minimum requirements?
https://wpml.org/home/minimum-requirements/

Based on provided debug information, I can see the following - WP Memory Limit: 40M.

Specifically, could you set WP Memory limit to at least 256MB and then let me know if this fixed your issue?
https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

If unsure on how to set this, you can consult your host/server admin to do this. After you increase this value, you can confirm it by checking on WPML -> Support by finding the “Memory limit” value

Regards,
Bruno Kos

May 20, 2019 at 1:01 pm #3847023

Brendan Cote

I have increased the memory as you said. The site is fine until I re-activated wpm-string-translations. It is still throwing the same error as mentioned above. I have verified the query in question. The table wp_icl_string_pages contains over 4 million records and just one of the conditions ((su.language='en' and su.url IS NULL)) selects over 800,000 records. Is this normal?

May 20, 2019 at 1:54 pm #3847539

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Can you tell me if you are using GoDaddy hosting? As for the table size, see this:
https://wpml.org/forums/topic/database-table-icl_string_pages-too-big/#post-3222102

Regards,
Bruno Kos

May 20, 2019 at 2:16 pm #3847839

Brendan Cote

yes, we are using GoDaddy. We were on a shared hosting, but migrated to a self managed hosting package last fall.

Is this a problem?
thanks

May 21, 2019 at 7:52 am #3852821

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

yes, we are using GoDaddy.

I'm afraid that the issue may be related to this, yes. Several months ago, few of our clients reported the exact same issue and we weren't able to reproduce the issue on any other server we tried. All these clients had in common that they were using GoDaddy hosting.

However:
but migrated to a self managed hosting package last fall.

This may help us - can you check this link?
https://stackoverflow.com/questions/10563619/error-code-2013-lost-connection-to-mysql-server-during-query

There are several ideas on how to possibly get this resolved - can you reach for the hosting support and perhaps suggest the following:
https://stackoverflow.com/a/12790569/
https://stackoverflow.com/a/10563643/
...
and other answers below this. Since we weren't able to reproduce this issue in our environments, it is most likely some of these values the culprit and the hosting support should try to identify them through server logs, since we are unable to do so for aforementioned reasons.

Let me know if you manage to find something or even resolve this, so that we could share this with our other clients, I would really appreciate if you could.

Regards,
Bruno Kos

May 21, 2019 at 10:17 am #3854239

Brendan Cote

Hi Bruno,

I will look into this and get back to you. I would still like to run the cleanup from the troubleshooting page.

I don't seem to have the following button:

You can try to reset the wp_icl_string_pages. This table is just a cache table.
- Go to WPML -> Support -> Troubleshooting page
- Press the "Recreate ST DB cache tables" button

This is the table that is taking up resources. Does another option on the troubleshooting take care of cleaning this table?

Thank you

May 21, 2019 at 11:23 am #3854719

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

- Press the "Recreate ST DB cache tables" button

Yes, this is the one, there is no other troubleshooting option. However, the issue we are having here is most likely not related to this table, but that's up to GoDaddy server support to determine and analyze through their logs.

Regards,
Bruno Kos

May 21, 2019 at 12:01 pm #3854951

Brendan Cote

I do not seem to have the button

May 21, 2019 at 3:01 pm #3856451

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

It is more below that, three buttons below "Remove comments that don't match the content's language" and above "Reset professional translation state" section.

Regards,
Bruno Kos

May 21, 2019 at 4:23 pm #3857199

Brendan Cote

Sorry, should have given you the full screen the first time. Here is the rest and there is no button
"Recreate ST DB cache tables"

May 22, 2019 at 6:04 am #3861053

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

In order to debug this issue further quickly, would you be willing to provide me with temporary WordPress admin username so I could investigate the issue directly? I have marked your next reply private so you can safely add this information.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Please make a full backup of your site before sharing this info!

You can use plugins such as UpdraftPlus WordPress Backup Plugin (https://wordpress.org/plugins/updraftplus/) or ask your host to perform a site backup.

Regards,
Bruno Kos

May 25, 2019 at 2:58 pm #3889599

Brendan Cote

Hi, I have created a backup and uploaded the whole site to another hosting company for testing and comparison since you said it was only seen before with GoDaddy hosting.

I have turned the string translations plugin back on and I do NOT have an error anymore. I am now thinking something happened in my hosting package that evening.

Thank you for guiding me in the right direction and also mentioning the troubleshooting page you have. ( I still don't have the button to recreate the cache tables, but my original problem is somewhat solved and not your issue).

May 25, 2019 at 3:00 pm #3889607

Brendan Cote

My issue is resolved now. Thank you!