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 topic contains 9 replies, has 2 voices.

Last updated by Raja Mohammed 2 weeks, 6 days ago.

Assigned support staff: Raja Mohammed.

Author Posts
August 18, 2019 at 10:26 am

mohameda-45

Dear ,
I got this mysql error on Error.Log file

please check and try to help me to fix.


[18-Aug-2019 10:07:28 UTC] WordPress database 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 'true' at line 8 for query 
	CREATE TABLE IF NOT EXISTS `wp_icl_string_urls` (
	  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
	  `language` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
	  `url` varchar(255) DEFAULT NULL,
	  PRIMARY KEY (`id`),
	  UNIQUE KEY `string_string_lang_url` (`language`,`url`(191))
	)
	DEFAULT CHARACTER SET utf8mb4 COLLATE true 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, SitePress->init, do_action('wpml_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, wpml_tm_load, WPML_Translation_Management->load, do_action('wpml_tm_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, WPML_String_Translation->load, WPML_ST_Upgrade->run, WPML_ST_Upgrade->run_front_end, WPML_ST_Upgrade->maybe_run, WPML_ST_Upgrade_Db_Cache_Command->run
[18-Aug-2019 10:07:28 UTC] WordPress database 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 'true' at line 13 for query 
		CREATE TABLE `wp_icl_mo_files_domains` (
		  `id` int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
		  `file_path` varchar(250) NOT NULL,
		  `file_path_md5` varchar(32) NOT NULL,
		  `domain` varchar(45) NOT NULL,
		  `status` varchar(20) NOT NULL DEFAULT 'not_imported',
		  `num_of_strings` int(11) NOT NULL DEFAULT '0',
		  `last_modified` int(11) NOT NULL,
		  `component_type` enum('plugin','theme','other') NOT NULL DEFAULT 'other',
  		  `component_id` varchar(100) DEFAULT NULL,
		  UNIQUE KEY `file_path_md5_UNIQUE` (`file_path_md5`)
		)
	DEFAULT CHARACTER SET utf8mb4 COLLATE true 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, SitePress->init, do_action('wpml_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, wpml_tm_load, WPML_Translation_Management->load, do_action('wpml_tm_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, WPML_String_Translation->load, WPML_ST_Upgrade->run, WPML_ST_Upgrade->run_front_end, WPML_ST_Upgrade->maybe_run, WPML_ST_Upgrade_MO_Scanning->run, WPML_ST_Upgrade_MO_Scanning->create_table

August 19, 2019 at 7:43 am #4414119

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hi there,

I will help you with the issue.

Please let me know the steps to reproduce the issue.
- Is it happening during installing or configuration?
- What is the version of the WPML plugin you are using

Knowing about these details will help me assist you better.

Kind regards
Raja

August 19, 2019 at 7:54 am #4414143

mohameda-45

Dear ,

As I said , I got this mysql error on Error.Log file .

August 19, 2019 at 9:05 am #4414807

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I checked your site, it seems a few tables are missing, please follow the below steps to fix the missing tables.

1 - Make a full backup of your site (files and database). There are many free plugins on WordPress.org for this purpose.

2 - Add this code to the bottom of the functions.php file in your theme’s root folder.

function wpml_fix_missing_icl_tables() {
 
    if( function_exists( 'icl_sitepress_activate' ) )
 
        icl_sitepress_activate();
 
}
 
add_action( 'wp_footer', 'wpml_fix_missing_icl_tables' );

3 - Visit your site’s homepage at least one time.

4 - Remove the code.

Please let me know once done, I will verify the results for you

Kind regards
Raja

August 22, 2019 at 10:14 am #4438319

mohameda-45

I do this before and know again ,

I create table manually but still have the same error .

August 22, 2019 at 12:54 pm #4439495

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It seems like a permission issue with the database user. I tried to create the table manually with no luck using the WP-Phpmyadmin plugin. However, the query executes but the table is not created.

Can you please run the below MySQL quires from your MySql database dashboard. (not from the WordPress Phpmyadmin plugin.) . Once executed make sure the tables are created.

Recommended: Backup your database before you proceed

CREATE TABLE `wp_icl_mo_files_domains` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `file_path` varchar(250) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `file_path_md5` varchar(32) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `domain` varchar(45) COLLATE utf8mb4_unicode_520_ci NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'not_imported',
  `num_of_strings` int(11) NOT NULL DEFAULT '0',
  `last_modified` int(11) NOT NULL,
  `component_type` enum('plugin','theme','other') COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT 'other',
  `component_id` varchar(100) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `file_path_md5_UNIQUE` (`file_path_md5`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;
 
CREATE TABLE IF NOT EXISTS `wp_icl_string_urls` (
	  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
	  `language` varchar(7) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
	  `url` varchar(255) DEFAULT NULL,
	  PRIMARY KEY (`id`),
	  UNIQUE KEY `string_string_lang_url` (`language`,`url`(191))
	)
	DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

Let me know the results.

Regards
Raja

August 23, 2019 at 5:35 pm #4449217

mohameda-45

i created tables manually
is there is any other action requierd ?

thanks a lot

August 26, 2019 at 4:53 am #4455943

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I am still unable to see the table wp_icl_mo_files_domains and wp_icl_string_urls, in your database It seems like the issues similar to the one discussed here https://stackoverflow.com/questions/4061293/mysql-cant-create-table-errno-150
However im not 100% sure, This goes beyond my support ability and you might need to check with databae experts

One workaround I can suggest is
- Try creating a new database,
- Copy the existing contents to the new database
- Create the missing tables in the new database,
- Check if the tables are created properly in the new database
- Change the database connection in wp-config to your new database.
- Check if this helps resolve the issue

Kind regards
Raja

August 26, 2019 at 8:25 am #4456763

mohameda-45

Dear ,

I sure that i created the tables , and i created it again .
but once i created it just 20 second and deleted automatically again .
i don't know why ?

August 26, 2019 at 2:11 pm #4459603

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Not sure why it's happening, Could you please check the server error logs (not the WordPress debug log) maybe you can get some clue there. As far as I see the issue is not related to WPML but with the database.

The topic ‘[Closed] mysql error’ is closed to new replies.