ÔÙ̸mysqlµÄÅäÖÃÎļþmy.ini or my.cnf (Ö®Ò»)
ÈçÈôתÔر¾ÎÄ£¬Çë×¢Ã÷Ôʼ³ö´¦£ºhttp://hi.baidu.com/hexiong/blog/item/e860e5dd9b0d3ae376c6381a.html
(hexiong@baidu or iihero@CSDN)
ż¶ûÅöµ½ÓÐÈËÎÊʹÓÃmysqlÃüÁîÐУ¬ÀÏÈÃÈËÊäÈë--default-character-set=gbkÖ®ÀàÎÞÁĵÄÑ¡ÏÈÃÈË·³¡£ÈÃÈ˶àÊäÈëÁ˼¸¸ö×Ö·û£¬È·ÊµÓе㲻¶Ô¾¢¡£
¼ÓÉÏÓÐʱºò×Ô¼ºÓÐʱºòDIY£¬ºÜÉÙÔÚwindowsÉÏʹÓð²×°µÄ°æ±¾£¬×ÜÊǽâѹËõ£¬È»ºó·ÅÒ»¸ömy.iniµ½½âѹËõĿ¼Ï±ߵÄijһ¸öÌØÊâµÄλÖá£ÕâÑù£¬mysqlÃüÁîÐУ¬È±Ê¡Çé¿öÏ£¬·´¶øload²»µ½Õâ¸öÅäÖÃÎļþÁË¡£
¹ØÓÚmy.iniÎļþµÄ¼ÓÔØ˳Ðò£¬Ïê¼û£ºhttp://hi.baidu.com/hexiong/blog/item/313534a8b7e0dcbdcb130cc5.html
ÒÔwindowsΪÀý£¬Ëü»áÕâÑù¼ÓÔØ£º
C:\WINDOWS\my.cnf¡¡C:\WINDOWS\my.ini¡¡C:\my.cnf ¡¡C:\my.ini
ÖÁÓÚ$installdir\my.ini£¬ºÙ, ²»ÊÇ°²×°°æ£¬Õâ¸ö±äÁ¿¹À¼ÆÊǶÁ²»µ½ÁË¡£
ÉÏÊöËĸöÎļþ£¬Ö»ÒªÇ°ÃæµÄijһ¸öÎļþ¼ÓÔسɹ¦£¬¾Í²»ÔÙ¼ÓÔغó±ßÖ¸¶¨µÄÅäÖÃÎļþÁË¡£
ËùÒÔ£¬ÒªÏëʹmysqlÃüÁîÐÐÖ±½ÓʹÓÃgbk×Ö·û¼¯£¬ÓÐÏÂÊö·½·¨£º
1. ÃüÁîÐУº
mysql -u test -p --default-character-set=gbk
2. ÃüÁîÐУº
mysql --defaults-file=<your real my.ini path> -u test -p
×¢Òâ --defaults-fileÓÀÔ¶Òª·Åµ½µÚÒ»¸ö²ÎÊýµÄλÖÃ
3. Ö±½ÓÖÆ×÷Ò»¸ö¿Í»§¶Ë°æ±¾µÄmy.ini£¬È磺
#Uncomment or Add only the keys that you know how works.
#Read the MySQL Manual for instructions
[client]
port = 3306
default_character_set=gbk
°ÑËü´æµ½c:\my.ini
ÕâÀïÐèҪ˵Ã÷µÄÊÇ£º
Èç¹ûÄ㶨ÖƵÄmysqlÖÐmy.iniÎļþ±¾À´¾ÍÔÚÉϱß4¸ö·¾¶ÀïÍ·£¬Ö±½ÓÐÞ¸ÄÀï±ß[client]ϵÄdefault_character_setֵΪgbkºÃ¿É¡£·ñÔò¾Í¿ÉÒÔÉú³ÉÒ»¸öרΪclientʹÓõÄmy.ini
·½·¨3ËäÈ»·½±ã£¬µ«ÒòΪÊÇÈ«¾ÖÅäÖÃÎļþ£¬ËùÒÔÓÐʱºò²»Ãâ»áÏ໥ӰÏ죬ÓÈÆäÊÇһ̨»úÆ÷Óжà¸ömysql¡£
Õâ¸öʱºò£¬¿ÉÒÔʹÓÃÃüÁîÐУº
d:\>mysql -u test -p --default-character-set=latin1
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 5.0.9-beta-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show variables like 'char%';
+--------------------------+-------------------------------------------+
| Variable_name  
Ïà¹ØÎĵµ£º
1¡¢¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý
2¡¢É¾³ýMySQLÎļþ¼ÐϵÄmy.iniÎļþ£¬Èç¹û±¸·ÝºÃ£¬¿ÉÒÔÖ±½Ó½«Îļþ¼ÐÈ«²¿É¾³ý
3¡¢¿ªÊ¼->ÔËÐÐ-> regedit ¿´¿´×¢²á±íÀïÕ⼸¸öµØ·½É¾³ýûÓÐ
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL Ŀ¼ɾ³ý
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\S ......
ÔÚwindowsÏ£º
´ò¿ªÃüÁîÐд°¿Ú£¬Í£Ö¹mysql·þÎñ(»òÕßÔÚÈÎÎñ¹ÜÀíÆ÷Àï½áÊøµômysqld-nt.exe½ø³Ì)£º Net stop mysql
Æô¶¯mysql£¬Ò»°ãµ½mysqlµÄ°²×°Â·¾¶£¬ÕÒµ½ mysqld-nt.exe
Ö´ÐУºmysqld-nt --skip-grant-tables
ÁíÍâ´ò¿ªÒ»¸öÃüÁîÐд°¿Ú£¬Ö´ÐÐmysql
use mysql
update us ......
»ù´¡²¿·Ö
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now() |
+----------------- ......
http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html
//Ö÷¼ü549830479
alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);
//Ôö¼ÓÒ»¸öÐÂÁÐ549830479
alter table t2 add d timestamp;
alter table infos add ex tinyint n ......
ÓÒ¼üÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿
¿ÉÒÔ¿´µ½ÓÐÓû§±äÁ¿ºÍϵͳ±äÁ¿
ÔÚÕâÀïÎÒÃÇ¿ÉÒÔ½øÐÐÐ޸Ļ·¾³±äÁ¿
±ÈÈç˵ÎÒÃÇ°²×°ÁËMySQL·þÎñÆ÷£¬Ïë½øÈëMySQLµÄÃüÁîÐеĻ°¾Í±ØÐëÔËÐÐcmd
Èç¹ûûÓÐÉèÖû·¾³±äÁ¿µÄ»°ÎÒÃDZØÐë½øÈëMySQLµÄ°²×°Â·¾¶²ÅÄÜʹÓÃmysql -u root -pÕâ¸öÃüÁî
ÕâÑù»á¸øÎÒÃÇ´øÀ´ºÜ¶àÂé·³£¬ÕâʱºòÎÒÃÇÏëÔ ......