mysql change the character set to utf8 && mysql Chinese input problem can not be solved

Wrote TT; I'm sorry! !

Ah, can not input Chinese, most of the problem is mysql character set, of course, other problems are also possible,

Here we set the mysql character set in two ways, the way graphical and command-line tool (a kind of operation can be done)

First, modify the database must first modify the default character set and mysql sql-mode modification or before the comment field of the character set table

  • Open Directory mysql Mysql installation of ---- "MySQL Server 5.7 ---" my.ini file ah, there can not find the words to search directly in the root directory of about MySQL Server or my.ini try
  •  
  • Use Notepad to open my.ini file. The first step in modifying sql-mode, click Edit notepad on top, then click Find, enter sql-mode, if you have put that comment out the line, if not do not control, generally Yes, (this can also be modified online search, but the meaning is the same, SQL-the MODE = " STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION " become-the MODE = SQL " NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION ")

  • Become so

  •  

    Then modify the configuration file default character set and character-set-server default-character-set as default-character-set = utf8 and character-set-server = utf8

 

Ah, empathy, default-character-set is the same with the above modifications

 

 

 

Remember to save changes to your oh. Ah, that done, to restart the mysql service, in the lower left corner of the desktop search to the service, and then find the service name has Mysql characters and then restart.

 

 

 Second, the next step is to modify the character set of database fields, table

图形化工具:我使用的是 Navicat for  mysql

这些步骤简单直接上图 修改数据库的,修改完确认

 

然后是数据表的

 

 

 

 

 嗯,做完这些之后,在插入一次试一下可以插入中文不。

 

嗯,命令行的有机会在补存。

TT   ^_^

 

参考博客:

https://www.cnblogs.com/liuzhen1995/p/5689772.html

https://www.cnblogs.com/sunzn/archive/2013/03/14/2960248.html

https://www.cnblogs.com/zhaoshunjie/p/4570783.html

 

 

Guess you like

Origin www.cnblogs.com/liruilong/p/11257451.html