Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÔÙ̸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      


Ïà¹ØÎĵµ£º

MySQLÊý¾Ý¿âÉè¼ÆÔ­Ôò

ת×Ô http://www.supidea.com/post/mysql_design_database.aspx
MySQLÊý¾Ý¿âÉè¼ÆÔ­Ôò
MySQL¶ÔÓÚ³ÉΪһ¸ö·Ç³£¿ìËÙµÄÊý¾Ý¿â·þÎñÆ÷ÓÐ×ŵ±Ö®ÎÞÀ¢µÄÃûÉù£¬ËüÒ²·Ç³£ÈÝÒ×ÉèÖúÍʹÓá£Ëæ×ÅËü×÷ΪÍøÕ¾ºó¶ËÊý¾Ý¿âµÃÉùÍûÈÕÔö£¬ÆäЧ¹ûÔÚÈ¥Ä꿪ʼÓÐÃ÷ ÏÔÌá¸ß¡£µ«ÊǺܶàMySQLÓû§¸ü¶àµØÖªµÀÈçºÎ´´½¨Ò»¸öÊý¾Ý¿â²¢±àд¶ÔËüµÄ²éѯ¡£¾ÍÏñ³ÉÇ ......

MysqlÍü¼ÇrootÃÜÂëµÄ½â¾ö°ì·¨

ÔÚwindowsÏ£º
´ò¿ªÃüÁîÐд°¿Ú£¬Í£Ö¹mysql·þÎñ(»òÕßÔÚÈÎÎñ¹ÜÀíÆ÷Àï½áÊøµômysqld-nt.exe½ø³Ì)£º        Net stop mysql
Æô¶¯mysql£¬Ò»°ãµ½mysqlµÄ°²×°Â·¾¶£¬ÕÒµ½ mysqld-nt.exe
Ö´ÐУºmysqld-nt --skip-grant-tables
ÁíÍâ´ò¿ªÒ»¸öÃüÁîÐд°¿Ú£¬Ö´ÐÐmysql
use mysql
update us ......

ubuntu mysqlµÄ°²×°

sudo apt-get install mysql-server
Õâ¸öÓ¦¸ÃºÜ¼òµ¥ÁË£¬¶øÇÒÎÒ¾õµÃ´ó¼ÒÔÚ°²×°·½ÃæҲûʲô̫´óÎÊÌ⣬ËùÒÔÒ²¾Í²»¶à˵ÁË£¬ÏÂÃæÎÒÃÇÀ´½²½²ÅäÖá£
ÅäÖÃMySQL
×¢Ò⣬ÔÚUbuntuÏÂMySQLȱʡÊÇÖ»ÔÊÐí±¾µØ·ÃÎʵģ¬Èç¹ûÄãÒªÆäËû»úÆ÷Ò²Äܹ»·ÃÎʵĻ°£¬ÄÇôÐèÒª¸Ä±ä/etc/mysql/my.cnfÅäÖÃÎļþÁË£¡ÏÂÃæÎÒÃÇÒ»²½²½µØÀ´£º
ĬÈϵÄMySQL°²× ......

MySQLÖÐgroup_concatº¯Êý


±¾ÎÄͨ¹ýʵÀý½éÉÜÁËMySQLÖеÄgroup_concatº¯ÊýµÄʹÓ÷½·¨£¬±ÈÈçselect group_concat(name) ¡£
MySQLÖÐgroup_concatº¯Êý
ÍêÕûµÄÓï·¨ÈçÏ£º
group_concat([DISTINCT] ÒªÁ¬½ÓµÄ×ֶΠ[Order BY ASC/DESC ÅÅÐò×Ö¶Î] [Separator '·Ö¸ô·û'])
»ù±¾²éѯ
mysql> select * from aa;
+------+------+
| id| name |
+----- ......

mysql ÐÞ¸ÄÃÜÂë

use mysql
update user set Password=password('newpassword') where User='root';
flush privileges;
Ê×ÏÈÒªÉùÃ÷Ò»µã£¬´ó²¿·ÖÇé¿öÏ£¬ÐÞ¸ÄMySQLÊÇÐèÒªÓÐmysqlÀïµÄrootȨÏ޵ģ¬
ËùÒÔÒ»°ãÓû§ÎÞ·¨¸ü¸ÄÃÜÂ룬³ý·ÇÇëÇó¹ÜÀíÔ±¡£
·½·¨Ò»
ʹÓÃphpmyadmin£¬ÕâÊÇ×î¼òµ¥µÄÁË£¬ÐÞ¸Ämysql¿âµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ