MySQLµÄ¡°SET NAMES x¡±×Ö·û¼¯ÎÊÌâ·ÖÎö
MySQLµÄ×Ö·û¼¯ÎÊÌâ¡£WindowsÏ¿Éͨ¹ýÐÞ¸Ämy.iniÄÚµÄ
CODE:
# CLIENT SECTION
[mysql]
default-character-set=utf8
#
SERVER SECTION
[mysqld]
default-character-set=utf8
Õâ
Á½¸ö×Ö¶ÎÀ´¸ü¸ÄÊý¾Ý¿â
µÄ
ĬÈÏ×Ö·û¼¯¡£µÚÒ»¸öÊÇ¿Í»§¶ËĬÈϵÄ×Ö·û¼¯£¬µÚ¶þ¸öÊÇ·þÎñÆ÷¶ËĬÈϵÄ×Ö·û¼¯¡£¼ÙÉèÎÒÃÇ°ÑÁ½¸ö¶¼ÉèΪutf8£¬È»ºóÔÚMySQL Command Line
ClientÀïÃæÊäÈë“show variebles like“character_set_%”;”£¬¿É¿´µ½ÈçÏÂ×Ö·û£º
character_set_client
latin1
character_set_connection latin1
character_set_database
utf8
character_set_results latin1
character_set_server utf8
character_set_system
utf8
ÆäÖеÄutf8Ëæ×ÅÎÒÃÇÉÏÃæµÄÉèÖöø¸Ä¶¯¡£´Ëʱ£¬ÒªÊÇÎÒÃÇͨ¹ý²ÉÓÃUTF-8µÄPHP³ÌÐò´ÓÊý¾Ý¿âÀï¶ÁÈ¡Êý¾Ý£¬ºÜÓпÉÄÜ
ÊÇÒ»´®“?????”»òÕßÊÇÆäËûÂÒÂë¡£ÍøÉϲéÁË°ëÌ죬½â¾ö°ì·¨µ¹ÊǼòµ¥£¬ÔÚÁ¬½ÓÊý¾Ý¿âÖ®ºó£¬¶ÁÈ¡Êý¾Ý֮ǰ£¬ÏÈÖ´ÐÐÒ»Ïî²éѯ“SET NAMES
UTF8”£¬¼´ÔÚPHPÀïΪ
mysql_query("SET NAMES UTF8");
¼´¿ÉÏÔʾÕý³££¨Ö»ÒªÊý¾Ý¿âÀï
ÐÅÏ¢µÄ×Ö·ûÕý³££©¡£ÎªÊ²Ã´»áÕâÑù£¿Õâ¾ä²éѯ“SET NAMES UTF8”µ½µ×ÊÇʲô×÷Óã¿
µ½MySQLÃüÁîÐÐÊäÈë“SET
NAMES UTF8;”£¬È»ºóÖ´ÐГshow variebles
like“character_set_%”;”£¬·¢ÏÖÔÀ´Îªlatin1µÄÄÇЩ±äÁ¿“character_set_client”¡¢
“character_set_connection”¡¢“character_set_results”µÄֵȫ²¿±äΪutf8ÁË£¬ÔÀ´ÊÇÕâ3¸ö±äÁ¿ÔÚµ·
µ°¡£²éÔÄÊֲᣬÉÏÃæÄǾäµÈÓÚ
¿´¿´Õâ3¸ö±äÁ¿µÄ×÷Óãº
ÐÅÏ¢ÊäÈë·¾¶£ºclient→connection→server£»
ÐÅ
Ï¢Êä³ö·¾¶£ºserver→connection→results¡£
»»¾ä»°Ëµ£¬Ã¿¸ö·¾¶Òª¾¹ý3´Î¸Ä±ä×Ö·û¼¯±àÂë¡£ÒÔ³öÏÖÂÒÂëµÄÊä³öΪ
Àý£¬serverÀïutf8µÄÊý¾Ý£¬´«ÈëconnectionתΪlatin1£¬´«ÈëresultsתΪlatin1£¬utf-8Ò³ÃæÓÖ°Ñresults
ת¹ýÀ´¡£Èç¹ûÁ½ÖÖ×Ö·û¼¯²»¼æÈÝ£¬±ÈÈçlatin1ºÍutf8£¬×ª»¯¹ý³Ì¾ÍΪ²»¿ÉÄæµÄ£¬ÆÆ»µÐԵġ£ËùÒÔ¾Íת²»»ØÀ´ÁË.
µ«ÕâÀïÒªÉùÃ÷Ò»
µã£¬“SET NAMES UTF8”×÷ÓÃÖ»ÊÇÁÙʱµÄ£¬MySQLÖØÆôºó¾Í»Ö¸´Ä¬ÈÏÁË¡£
½ÓÏÂÀ´¾Í˵µ½MySQLÔÚ·þÎñÆ÷ÉϵÄÅäÖÃÎÊÌâÁË¡£Æñ²»ÊÇÎÒ
ÃÇÿ´Î¶ÔÊý¾Ý
Ïà¹ØÎĵµ£º
ʹÓÃPorts·½Ê½ÔÚFreeBSDÏÂÅäÖÃMySQL,Apache,PHP
ÓôÃÆÁ˺ü¸Ìì,ÖÕÓÚÔÚFreeBSDϽ«MySQL,Apache,PHPµÄ»·¾³ÅàÖ²ºÃÁË.ϱ߰ÑÅäÖò½ÖèºÍ×¢ÒâµãÂÞÁÐÔÚϱß,ºÍ´ó¼Ò·ÖÏí.
FreeBSD°æ±¾ÊÇ7.3,MySQL°æ±¾ÊÇ5.0.90,Apache°æ±¾ÊÇ2.2.14£¨1.3.42£©,PHP°æ±¾ÊÇ5.2.12.Îҵݲװ˳ÐòÊÇÏÈMySQL,È»ºó°²×°ApacheºÍPHP,Ò»°ãÊÇ°²×°Í ......
Ò» Apache µÄ°²×°
1 Apache µÄ°²×°
2 ͬÒâÐÒé
3 ½Ó×Å "Next "
4 Ìîд ÓòÃû(network domain) ·þÎñÆ÷µÄÃû³Æ (Server Name) ¹ÜÀíÕßÓÊÏä(Administrator's Email)
5 °²×°ÀàÐÍ
6 Ñ¡Ôñ°²×°Â·¾¶
7 µã»÷“install ” ¼ÌÐø
8 ¿ªÊ¼°²×°
9 °²×°½áÊø
¶þ MySqlµÄ°²×°
......
ÒÔÇ°ÓùßÁËMSSQL£¬VC++ÓÐÇ¿´óµÄADOÖ§³Ömssql£¬·½±ã°¡£¬²»¹ÜÊÇÁ¬½Ó£¬²Ù×÷µÈ¶¼ÊÇÀÊÀÊÉÏÊÖ°¡¡£µ«ÊÇÏÖÔÚͻȻҪÓÃMySqlÁË£¬¿ªÊ¼Ã»ÓÐmssqlÄÇÑùµÄ²Ù×÷½çÃ棬ÎÒÕæÓеãÅų⡣°¥£¬Ã»°ì·¨£¬¹«Ë¾ÒªÇó£¬Ö»ÄÜÑо¿MySqlÔõôÓÃÁË¡£
¸Õ¿ªÊ¼¾ÍÓöµ½ÁËÒ»¸ö»ù±¾µÄÎÊ ......
Mysql·½Ê½£º
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MysqlDB {
private String strClass = "com.mysql.jdbc.Driver";
private String strDriver = "jdbc:mysql://localhost: ......
¿ÉÒԲο¼ÏÂÁÐÎÄÕÂ
http://www.mysqlperformanceblog.com/2010/03/23/too-many-connections-no-problem/
½áÂÛÈçÏ£º
£¨1£©mysqlĬÈÏ»á¸øsuperÓû§ÁôÒ»¸öÁ¬½Ó£¬Äã¿ÉÒÔÓÃÕâ¸öÔ¤ÁôµÄÁ¬½ÓÀ´µÇ¼£¬À´Ôö¼ÓÁ¬½ÓÊý£»µ«ÊÇÈç¹ûÁ¬½ÓµÄÓû§È«ÊÇsuperȨÏ޵ģ¬ÔòÕâ¸öÔ¤ÁôµÄÁ¬½Ó²»´æÔÚ¡£Õâʱ¿ÉÒÔÓÃÒÔϵÄÃüÁîÀ´ÉèÖÃÁ¬½ÓÊý£ºgdb -p $(cat ......