About MySQL Database insert data, cannot insert Chinese and garbled problem in Chinese

Source: Internet
Author: User

first, recommend a blog: http://www.cnblogs.com/sunzn/archive/2013/03/14/2960248.html

At that time, after I installed the MySQL database, after a new database to insert data, the first occurrence of the Chinese can not insert the MySQL database problem, the solution is as follows:

Modify sql-mode="strict_trans_tables,no_auto_create_user,no_engine_substitution" in My.ini in MySQL file become sql-mode= "No_auto_create_user,no_engine_substitution", after the modification, restart the MySQL service, you can solve the problem of Chinese can not be inserted.

Next, you may find that the inserted Chinese has garbled problems, then the solution is to modify the My.ini file in the Character-set-server=utf8 and Character-set-server=utf8 These two sentences, if not utf8 all changes to the UTF8 format, so restart the MySQL service again to solve the problem of inserting Chinese garbled. (PS: There will be a new problem, that is, the database has been created in the past, the insertion of Chinese may also appear in Chinese garbled, the solution is to delete the original database created, re-create an identical database, there will be no insertion of Chinese garbled problem.)

The My.ini file after the specific modification is as follows (here is my own MySQL My.ini file, only for reference OH):

################### #配置文件开始 ################### # for advice on how toChange settings# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# * * * Don't EDIT this FILE. It's a template which 'll be copied to the# ***defaultLocation during install, andwould be replacedif You# * * * Upgrade toA newer version ofMySQL. [Client]default-character-set=utf8 [mysqld] Character-set-server=utf8 port=3306Basedir ="f:\mysql/"DataDir ="f:\mysql/data/"Tmpdir ="f:\mysql/data/"socket ="F:\mysql/data/mysql.sock"log-error="F:\mysql/data/mysql_error.log"#server_id =2#skip-locking max_connections= -table_open_cache= thequery_cache_size=1m tmp_table_size=32m thread_cache_size=8innodb_data_home_dir="f:\mysql/data/"Innodb_flush_log_at_trx_commit =1innodb_log_buffer_size=128m innodb_buffer_pool_size=128m innodb_log_file_size=10m innodb_thread_concurrency=  -innodb-autoextend-increment= +join_buffer_size = 128M Sort_buffer_size = 32M Read_rnd_buffer_size = 32M Max_allowed_packet = 32M explicit_defaults_ for_timestamp=trueSql-mode="no_auto_create_user,no_engine_substitution"#Sql_mode=no_engine_substitution,strict_trans_tables################### #配置文件结束 ###################

About MySQL Database insert data, cannot insert Chinese and garbled problem in Chinese

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.