How to solve mysql#1366 errors in combat

Source: Internet
Author: User
Keywords MySQL

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

mysql#1366 error is in mysql5.0.2 above version, whether the code or the field does not conform to the rules, will not pass MySQL strict data inspection, #1366错误就是这样出现的. Of course, if you have the right to modify My.ini, usually #1366 is a good solution. Just put the sql-mode= "Strict_trans_tables,no_auto_create_user,no_engine_substitution" in My.ini into Sql-mode= "NO_AUTO_ Create_user,no_engine_substitution "on it. The virtual host usually does not have this kind of modification permission, if is the coding problem causes the #1366 error, then please see my below introduction. It may be of some help to you.

I use the xoops frame of the website (www.visteel.com) has moved several times, because every move did not do a good job of the database coding, with the increase in data tables, gb2312, GBK, UTF8, latin1, and other character finishing methods are mixed together. The MySQL version of the virtual host is already 5.1.36, and finally in the data update, the #1366 error occurred. Well, let's talk about the solution. First of all, my Web site database is GBK, then the inside of all the data table to reorganize it.

However, the table that has stored the data can not be easily handled by phpMyAdmin and other management tools. This time you need two tools, one is MYSQLODBC download and press install Mysql-connector-odbc-5.1.8-win32 one is navicatformysql.

The first step: Control Panel-> Management tool-> data source. Create a MYSQLODBC data source under local windows, assuming it is named Visteel

Step Two: Open Navicatformysql, click the "Connection" button to set the connection.

Step three: After connecting to the database server, right-click the database server and select "Newdatabase ..." to create a new database. Remember "Characterset" selected GBK;

Step Fourth: Select the tables you want to convert, drag them to the new database, select "Copyhere (structureonly)" In the pop-up Options window, and copy the structure of the datasheet to the new database;

Fifth step: In the New database selected just guide all the table, right select "Dumpsqlfile" exported to SQL files;

Step Sixth: Open the newly exported SQL file with a text editor, replace all the defaultcharset= behind it with DEFAULTCHARSET=GBK, and save the modified SQL file.

Step Seventh: Select all the tables in the newly created database and click Deletetable to delete them. Then right click on the new database to select "Executesqlfile ...", locate and double-click the changed SQL file, and return the changed SQL file back to the database.

Eighth step: Select the new database and then click: "Importwizard" button. Select ODBC and click Next.

Nineth step: Point "importfrom:" The Right "..." button, and then select Connection in the Data Connection Properties window, select the data source "Visteel" that you established in the first step in "1, specify data source," and then return to the "Step2of8" window and select the table you want to convert , or click the "SelectAll" button to select all the tables for the entire database. Click on the "Next" button three consecutive times to the "Step7of8" dialog box.

Tenth step: Select "Copy:deleteallrecordsindestination,repopulatefromthesource": And then click "Next" to the "Step8of8" dialog box.

11th Step: Click the button "Start" to begin the conversion until the message "[msg][lmp]finished-successfully" appears.

To this end, the database completes the GBK. Edit the mainfile.php file in the XOOPS root directory to change define (' Xoops_db_charset ', ' gb2312 ') to define (' Xoops_db_charset ', ' GBK ');

Upload the local database export to the virtual host for testing, the mysql#1366 errors all disappeared. And uncommon Chinese characters are no longer used?? showed.

Admin5 starting, reprint please indicate the source of the article www.visteel.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.