MySQLѧϰ2
Á˽âÁËһЩ×î»ù±¾µÄ²Ù×÷ÃüÁîºó£¬ÎÒÃÇÔÙÀ´Ñ§Ï°ÈçºÎ´´½¨Ò»¸öÊý¾Ý¿âºÍÊý¾Ý¿â±í¡£
1¡¢Ê¹ÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
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:
ÎÒÃÇÒª½¨Á¢Ò»¸öÄ㹫˾Ա¹¤µÄÉúÈÕ±í£¬±íµÄÄÚÈÝ°üº¬Ô±¹¤ÐÕÃû¡¢ÐԱ𡢳öÉúÈÕÆÚ¡¢³öÉú³ÇÊС£
mysql> CREATE TABLE mytable (name VARCHAR(20), 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ÏÔʾÊý¾Ý¿âÖÐÓÐÄÄЩ±í£º
mysql> SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| mytables |
+---------------------+
5¡¢ÏÔʾ±íµÄ½á¹¹£º
mysql> DESCRIBE mytable;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| | char(1) | YES | | NULL | |
| birth &n
Ïà¹ØÎĵµ£º
LOAD DATA INFILE
ÕâÊÇÎÒÃÇÒª½éÉܵÄ×îºóÒ»¸öµ¼ÈëÊý¾Ýµ½MySQLÊý¾Ý¿âÖеķ½·¨¡£Õâ¸öÃüÁîÓëmysqlimport·Ç³£ÏàËÆ£¬µ«Õâ¸ö·½·¨¿ÉÒÔÔÚmysqlÃüÁîÐÐÖÐʹÓá£Ò²¾ÍÊÇ˵Äú¿ÉÒÔÔÚËùÓÐʹÓÃAPIµÄ³ÌÐòÖÐʹÓÃÕâ¸öÃüÁʹÓÃÕâÖÖ·½·¨£¬Äú¾Í¿ÉÒÔÔÚÓ¦ÓóÌÐòÖе¼ÈëÄúÏëÒªµ¼ÈëµÄÊý¾Ý¡£ ʹÓÃÕâ¸öÃüÁî֮ǰ£¬mysqld½ø³Ì£¨·þÎñ£©±ØÐëÒѾÔÚÔËÐ ......
½â¾ö·½·¨£º
1¡£ ¸Ä±í·¨¡£¿ÉÄÜÊÇÄãµÄÕʺŲ»ÔÊÐí´ÓÔ¶³ÌµÇ½£¬Ö»ÄÜÔÚlocalhost¡£Õâ¸öʱºòÖ»ÒªÔÚlocalhostµÄÄÇ̨µçÄÔ£¬µÇÈëmysqlºó£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï´Ó"localhost"¸Ä³Æ"%"
mysql -u root -pvmwaremysql>use mysql;
mysql>update ......
ÖØװʱ³öÏÖcould not start the service mysql error:0µÄ´íÎóʱ
ÔÚ¿ØÖÆÃæ°åÖÐÔËÐÐÌí¼Óɾ³ý³ÌÐò£¬½«mysqlжÔØ;
жÔغó´ò¿ª×¢²á±í£¬²é¿´HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services ϵļüÖµ£¬Èç¹ûÓÐÏà¹Ømysql¼üÖµ(mysql¡¢mysqladmin)Ôòɾµô£¬¼´¿É;
ÖØÆô£¬½«mysqlµÄ°²×°²ÐÓàĿ¼ɾµô (²é¿´·þÎñ£¬´Ëʱ·þÎñÖÐÒÑû ......
Õª×Ôhttp://blog.csdn.net/ljah/archive/2006/11/08/1373959.aspx
¸ñʽ£º
CREATE PROCEDURE ¹ý³ÌÃû ([¹ý³Ì²ÎÊý[,...]])
[ÌØÐÔ ...] ¹ý³ÌÌå
CREATE FUNCTION º¯ÊýÃû ([º¯Êý²ÎÊý[,...]])
RETURNS ·µ»ØÀàÐÍ
[ÌØÐÔ ...] º¯ÊýÌå
¹ý³Ì²ÎÊý:
[ IN | OUT | INOUT ] ²ÎÊýÃû ²ÎÊýÀàÐÍ
º¯Êý²ÎÊý:
²ÎÊýÃû ²ÎÊýÀàÐÍ
·µ»ØÀàÐÍ: ......
Ò»¡¢Á¬½ÓMYSQL
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû -pÓû§ÃÜÂë
1¡¢ÈôÊÇÁ¬½Óµ½±¾»úÉϵÄMYSQL£ºÊ×ÏÈ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼mysql\bin£¬»òÕß½«mysql\bin°²×°Â·¾¶ÉèÖÃÔÚ»·¾³±äÁ¿pathÖУ¬ÔÙ¼üÈëÃüÁîmysql -u root -p£¬»Ø³µºóÌáʾÄãÊäÃÜÂë.×¢ÒâÓû§ÃûÇ°¿ÉÒÔÓпոñÒ²¿ÉÒÔûÓпոñ£¬µ«ÊÇÃÜÂëÇ°± ......