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

ÓÃMySQL´´½¨Êý¾Ý¿âºÍÊý¾Ý¿â±í

1¡¢Ê¹ÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
 
de>de>mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql | | test | +----------+ 3 rows in set (0.00 sec)
    2¡¢´´½¨Ò»¸öÊý¾Ý¿âabccs
     mysql> CREATE DATABASE abccs;
     ×¢Òⲻͬ²Ù×÷ϵͳ¶Ô´óСдµÄÃô¸Ð¡£
    3¡¢Ñ¡ÔñÄãËù´´½¨µÄÊý¾Ý¿â
     mysql> USE abccs
     Database changed
     ´ËʱÄãÒѾ­½øÈëÄã¸Õ²ÅËù½¨Á¢µÄÊý¾Ý¿âabccs.
    4¡¢ ´´½¨Ò»¸öÊý¾Ý¿â±í
     Ê×ÏÈ¿´ÏÖÔÚÄãµÄÊý¾Ý¿âÖдæÔÚʲô±í£º
     mysql> SHOW TABLES;
     Empty set (0.00 sec)
     ˵Ã÷¸Õ²Å½¨Á¢µÄÊý¾Ý¿âÖл¹Ã»ÓÐÊý¾Ý¿â±í¡£ÏÂÃæÀ´´´½¨Ò»¸öÊý¾Ý¿â±ímytable:
     ÎÒÃÇÒª½¨Á¢Ò»¸öÄ㹫˾Ա¹¤µÄÉúÈÕ±í£¬±íµÄÄÚÈݰüº¬Ô±¹¤ÐÕÃû¡¢ÐԱ𡢳öÉúÈÕÆÚ¡¢³öÉú³ÇÊС£
 
de>de>mysql> CREATE TABLE mytable (name VARCHAR(20), sex CHAR(1), -> birth DATE, birthaddr VARCHAR(20)); Query OK, 0 rows affected (0.00 sec)
     ÓÉÓÚname¡¢birthaddµÄÁÐÖµÊDZ仯µÄ£¬Òò´ËÑ¡ÔñVARCHAR£¬Æä³¤¶È²»Ò»¶¨ÊÇ20¡£¿ÉÒÔÑ¡Ôñ´Ó1µ½255µÄÈκγ¤¶È£¬Èç¹ûÒÔºóÐèÒª¸Ä±äËüµÄ×Ö³¤£¬¿ÉÒÔʹÓÃALTER TABLEÓï¾ä¡££©;ÐÔ±ðÖ»ÐèÒ»¸ö×Ö·û¾Í¿ÉÒÔ±íʾ£º"m"»ò"f"£¬Òò´ËÑ¡ÓÃCHAR(1);birthÁÐÔòʹÓÃDATEÊý¾ÝÀàÐÍ¡£
     ´´½¨ÁËÒ»¸ö±íºó£¬ÎÒÃÇ¿ÉÒÔ¿´¿´¸Õ²Å×öµÄ½á¹û£¬ÓÃSHOW TABLESÏÔʾÊý¾Ý¿âÖÐÓÐÄÄЩ±í£º
 
de>de>mysql> SHOW TABLES; +---------------------+ | Tables in menagerie | +---------------------+ | mytables | +---------------------+
    5¡¢ÏÔʾ±íµÄ½á¹¹£º
 
de>de>mysql> DESCRIBE mytable; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | name | varchar(20) | YES | | NULL | | | sex | char(1) | YES | | NULL | | | bi


Ïà¹ØÎĵµ£º

mysql dataÎļþ¼ÐϵÄibdata1 Îļþ×÷ÓÃ


Õâ¸öÎļþ³¬¼¶´ó£¬ ²éÁËһϣ¬ ´ó¸ÅµÄ×÷ÓÃÈçÏÂ
ÊÇ´¢´æµÄ¸ñʽ
INNODBÀàÐÍÊý¾Ý״̬Ï£¬
ibdataÓÃÀ´´¢´æÎļþµÄÊý¾Ý
¶ø¿âÃûµÄÎļþ¼ÐÀïÃæµÄÄÇЩ±íÎļþÖ»Êǽṹ¶øÒÑ
ÓÉÓÚmysql4.1ĬÈÏÊÔinnodb£¬ËùÒÔÕâ¸öÎļþĬÈϾʹæÔÚÁËhttp://man.chinaunix.net/database/mysql/inonodb_zh/2.htm Õâ¸öÁ´½ÓÊÔinnodbµÄÖÐÎIJο¼£¬ innodbµÄ¶« ......

Ìí¼Ó/ɾ³ýMySQLÊý¾Ý¿â±íÖеÄ×Ö¶Î

Ìí¼Ó×ֶεĸñʽ
ALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name alter_specification [, alter_specification] ...alter_specification: table_option ... | ADD [COLUMN] col_name column_definition [FIRST | AFTER col_name ]
eg.
ALTER TABLE myTbl ADD COLUMN newItem VARCHAR(20) DEFAULT "0"  ......

mysql ³£¼û´íÎ󼯺Ï


 
1£º Can’t connect to [local] MySQL server´íÎó
Ò»¸öMySQL¿Í»§¿ÉÒÔÁ½ÖÖ²»Í¬µÄ·½Ê½Á¬½Ómysqld·þÎñÆ÷£ºUnixÌ×½Ó×Ö£¬Ëüͨ¹ýÔÚÎļþϵͳÖеÄÒ»¸öÎļþ(ȱʡ“/tmp /mysqld.sock”)½øÐÐÁ¬½Ó£»»òTCP/IP£¬Ëüͨ¹ýÒ»¸ö¶Ë¿ÚºÅÁ¬½Ó¡£UnixÌ×½Ó×Ö±ÈTCP/IP¸ü¿ì£¬µ«ÊÇÖ»ÓÐÓÃÔÚÁ¬½Óͬһ̨¼ÆËã»úÉϵķþÎñÆ÷¡£Èç¹ûÄ ......

MySQLɾ³ýÖ¸¶¨ÐÐ

mysql> select * from tx;
+------+
| id   |
+------+
|    4 |
|    7 |
|    3 |
|    9 |
|    5 |
+------+
5 rows in set (0.05 sec)
mysql> delete a from tx a inner join (select * from tx limit 2,2) b ......

Linux C MySQLÊý¾Ý¿âº¯Êý

1. ³õʼ»¯Ò»¸öÁ¬½Ó¾ä±ú
    MYSQL *mysql_init(MYSQL *);
    ÕýÈ·£º·µ»ØÒ»¸öÖ¸ÏòзÖÅäµÄÁ´½Ó¾ä±ú½á¹¹µÄÖ¸Õë
    ´íÎó£ºNULL
    ×¢£º¸Ãº¯ÊýµÄ´«Èë²ÎÊýͨ³£ÎªNULL¼´¿É¡£
2. ½¨Á¢ÎïÀíÁ¬½Ó
    MYSQL *mysql_real_connect(MYSQL *connect ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ