mysql×Ö·û¼¯ÎÊÌâ
À´Ô´: ChinaUnix²©¿Í ¡¡ÈÕÆÚ£º 2008.04.28 12:29¡¡(¹²ÓÐ0ÌõÆÀÂÛ) ÎÒÒªÆÀÂÛ
ÊÇÓÃmysqlµÄʱºò£¬×Ö·û±àÂëÊǸö´óÎÊÌ⣬ÎÒһֱʹÓÃutf8µÄ±àÂ룬»ù±¾ÉÏûʲô´óÎÊÌ⣬¾ÍÊÇÿ´ÎÆô¶¯mysqlµÄʱºò¶¼ÐèÒªÉèÖÃһϣ¬mysql£¬Ê±¼ä³¤ÁË£¬Ò²¹ÖÂé·³µÄ£¬ÔÚÍøÉÏËÑÁËһϣ¬·¢ÏÖÏÂÃæµÄ·½·¨ÄÜÍêÈ«½â¾öÕâ¸öÎÊÌ⣬µ±È»Èç¹ûÊÇ×Ô¼º±àÒëµÄmysql£¬ÔÚ±àÒëµÄʱºò×îºÃ¾ÍÖ¸¶¨±àÂ뼯£¬È»ºó½¨¿âµÄʱºòÉ趨ĬÈϵıàÂë¾ÍºÃÁË£¬ÕâÑù¾Í²»ÓÃÿ´Î¶¼set names utf8;ÁË£ºÏÂÃæÊÇÉèÖ÷½·¨£º
/etc/mysql/ Ö÷ÒªÅäÖÃÎļþËùÔÚλÖà my.cnf
/var/lib/mysql/ ·ÅÖõÄÊÇÊý¾Ý¿â±íÎļþ¼Ð£¬ÕâÀïµÄmysqlÏ൱ÓÚwindowsÏÂmysqlµÄdateÎļþ¼Ð
Æô¶¯mysqlºó£¬ÒÔrootµÇ¼mysql
>show variables like 'character%'; #Ö´ÐбàÂëÏÔʾ
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
ÔÚijЩʱºò£¬ÎÒÃÇÐøÒªÐÞ¸ÄmysqlĬÈÏÊý¾Ý¿âµÄ±àÂ룬ÒÔ±£Ö¤Ä³Ð©Ç¨ÒƵijÌÐò¿ÉÒÔÕý³£ÏÔʾ£¬±à¼my.cnfÎļþ½øÐбàÂëÐÞ¸Ä,windows¿ÉÒÔÖ±½ÓÓãÍysql Server Instance Config Wizard ½øÐÐÉèÖÃ
ÔÚlinuxÏÂÐÞ¸Ä3¸ömy.cnfµÄ1¸ö/etc/mysql/my.cnfÎļþ
ÕÒµ½¿Í»§¶ËÅäÖÃ[client] ÔÚÏÂÃæÌí¼Ó
default-character-set=utf8 ĬÈÏ×Ö·û¼¯Îªutf8
ÔÚÕÒµ½[mysqld] Ìí¼Ó
default-character-set=utf8 ĬÈÏ×Ö·û¼¯Îªutf8
init_connect='SET NAMES utf8' £¨É趨Á¬½ÓmysqlÊý¾Ý¿âʱʹÓÃutf8±àÂ룬ÒÔÈÃmysqlÊý¾Ý¿âΪutf8ÔËÐУ©
mysql> show variables like 'character_set_%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8&n
Ïà¹ØÎĵµ£º
For SQL Server2008:
http://www.microsoft.com/downloads/details.aspx?FamilyID=0e6168b0-2d0c-4076-96c2-60bd25294a8e&displaylang=en
For SQL Server2005:
http://www.microsoft.com/downloads/details.aspx?familyid=C6F14640-DA22-4604-AAAA-A45DE4A0CD4A&displaylang=en ......
1.¹Ø¼ü×Ö
auto_increment
2.×ÔÔöÓ÷¨
Àý:
CREATE TABLE animals ( id mediumint not null auto_increment,
name char(30) not null,
primary key (id));
3.¹ØÓÚ×ÔÔö
Q:Ôõô»ñµÃµ±Ç°µÄ×ÔÔöµÄ×î´óÖµ?
A:select @@identity
Q:Ôõô»ñµÃtableµÄµ±Ç°×ÔÔö×î´óÖµ?
A:select max(i ......
1. ¼ò½é
ÔÚWebÓ¦ÓóÌÐòÌåϵ¼Ü¹¹ÖУ¬Êý¾Ý³Ö¾Ã²ã£¨Í¨³£ÊÇÒ»¸ö¹ØϵÊý¾Ý¿â£©ÊǹؼüµÄºËÐIJ¿·Ö£¬Ëü¶ÔϵͳµÄÐÔÄÜÓзdz£ÖØÒªµÄÓ°Ïì¡£MySQLÊÇĿǰʹÓÃ×î¶àµÄ¿ªÔ´Êý¾Ý¿â£¬µ«ÊÇMySQLÊý¾Ý¿âµÄĬÈÏÉèÖÃÐÔÄܷdz£µÄ²î£¬½ö½öÊÇÒ»¸öÍæ¾ßÊý¾Ý¿â¡£Òò´ËÔÚ²úÆ·ÖÐʹÓÃMySQLÊý¾Ý¿â±ØÐë½øÐбØÒªµÄÓÅ»¯¡£
ÓÅ»¯ÊÇÒ»¸ö¸´ÔÓµÄÈÎÎñ£¬±¾ÎÄÃèÊöMySQLÏ ......
×î½üÒµÎñ·ÃÎÊÁ¿±È½Ï´ó£¬Êý¾Ýͳ¼ÆÀàµÄ²Ù×÷¶¼Çл»µ½mysqlµÄ±¸»úÉÏÈ¥ÁË£¬±¸»úµÄ¶Á²Ù×÷²»»áÓ°ÏìÖ÷¡¢±¸Ö®¼äµÄÈȱ¸µÄ
ÏÂÃæÁÐһϾßÌåµÄÔÀí£º
ÒªÏëÓúÃÒ»¸öϵͳ£¬Àí½âÆäʵÏÖÔÀíÊǷdz£ÖØÒªµÄÊÂÇ飬ֻÓÐÀí½âÁËÆäʵÏÖÔÀí£¬ÎÒÃDzÅÄܹ»Ñﳤ±Ü¶Ì£¬ºÏÀíµÄÀûÓ㬲ÅÄܹ»´î½¨³ö×îÊʺÏÎÒÃÇ×Ô¼ºÓ¦Óû·¾³µÄϵͳ£¬²ÅÄܹ»ÔÚϵͳʵʩ֮ºó¸üºÃµ ......
Mysql³õʼ»¯rootÃÜÂëºÍÔÊÐíÔ¶³Ì·ÃÎÊ
mysqlĬÈÏrootÓû§Ã»ÓÐÃÜÂ룬ÊäÈëmysql –u root ½øÈëmysql
1¡¢³õʼ»¯rootÃÜÂë
½øÈëmysqlÊý¾Ý¿â
1
mysql>update user set password=PASSWORD(‘123456’) where User='root';
2¡¢ÔÊÐímysqlÔ¶³Ì·ÃÎÊ,¿ÉÒÔʹÓÃÒÔÏÂÈýÖÖ·½Ê½:
a¡¢¸Ä±í¡£
1
mysql -u root – ......