MySQLµÄ³£ÓòÙ×÷½éÉÜ
×¢Ò⣺MySQLÖÐÿ¸öÃüÁîºó¶¼ÒªÒԷֺţ»½áβ¡£
£¨1£©ÏÔʾÊý¾Ý¿â
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.04 sec)
Mysql¸Õ°²×°ÍêÓÐÁ½¸öÊý¾Ý¿â£ºmysqlºÍtest¡£ÆäÖУ¬mysql¿â·Ç³£ÖØÒª£¬ËüÀïÃæÓÐMySQLµÄϵͳÐÅÏ¢£¬ÎÒÃǸÄÃÜÂëºÍÐÂÔöÓû§£¬Êµ¼ÊÉϾÍÊÇÓÃÕâ¸ö¿âÖеÄÏà¹Ø±í½øÐвÙ×÷¡£
£¨2£©ÏÔʾÊý¾Ý¿âÖеıí
mysql> use mysql; £¨´ò¿ª¿â£¬¶Ôÿ¸ö¿â½øÐвÙ×÷¾ÍÒª´ò¿ª´Ë¿â£¬ÀàËÆÓÚfoxpro £©
Database changed
mysql> show tables; £¨ÏÔʾ¸ÃÊý¾Ý¿âÖеÄÊý¾Ý±í£©
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv |
| db |
| func |
| host |
| tables_priv |
| user |
+-----------------+
6 rows in set (0.01 sec)
£¨3£©ÏÔʾÊý¾Ý±íµÄ½á¹¹£º
describe ±íÃû;
£¨4£©ÏÔʾ±íÖеļǼ£º
select * from ±íÃû;
ÀýÈ磺ÏÔʾmysql¿âÖÐuser±íÖеļͼ¡£ËùÓÐÄܶÔMySQLÓû§²Ù×÷µÄÓû§¶¼Ôڴ˱íÖС£
Select * from user;
£¨5£©½¨¿â£º
create database ¿âÃû;
ÀýÈ磺´´½¨Ò»¸öÃû×ÖλaaaµÄ¿â £ºmysql> create databases aaa;
£¨6£©½¨±í£º
use ¿âÃû£» £¨Ñ¡ÔñÊý¾Ý¿â£©
create table ±íÃû(×Ö¶ÎÉ趨Áбí)£»
ÀýÈ磺ÔÚ¸Õ´´½¨µÄaaa¿âÖн¨Á¢±íname,±íÖÐÓÐid(ÐòºÅ£¬×Ô¶¯Ôö³¤)£¬xm£¨ÐÕÃû£©,xb£¨ÐÔ±ð£©,csny£¨³öÉíÄêÔ£©Ëĸö×Ö¶Î
use aaa;
mysql> create table name (id int(3) auto_increment not null primary key, xm char(8),xb char(2),csny date);
¿ÉÒÔÓÃdescribeÃüÁî²ì¿´¸Õ½¨Á¢µÄ±í½á¹¹¡£
mysql> describe name;
+-------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+----------------+
| id | int(3) | | PRI | NULL | auto_increment |
| xm | char(8) | YES | | NULL | |
| xb | char(2) | YES | | NULL | |
| csny | date | YES
Ïà¹ØÎĵµ£º
ÓÐһЩûÓÐʹÓÃÊý¾Ý¿âÖмä¼þµÄÈí¼þ¿ÉÄÜ»áÅöµ½ÔÚ²»Í¬µÄÓ¦Óó¡¾°ÐèÒªÓò»Í¬µÄÊý¾Ý¿â£¬ÕâÑù¿ÉÄܾÍÐèÒª½«Êý¾Ý¿â´úÂë×öÒÆÖ²£¬ÎÒÕâÀïÕûÀíÁËһЩ´Óoracleµ½mysqlµÄÒÆÖ²¹ý³ÌÖеÄ×¢ÒâÊÂÏ
1¡£sequenceÉú³É
¿ÉÒÔÓÃÀàËƵĶ«Î÷À´×ö,ÈçÏ£º
create table myseq ( &nb ......
Ò»¡¢³£ÓÃ×Ö·û´®º¯Êý
1.CONCAT(str1,str2,...)
mysql> ? concat;
mysql> SELECT CONCAT('My', 'S', 'QL');
+-------------------------+
| CONCAT('My', 'S', 'QL') |
+-------------------------+
| MySQL ......
ÐÞ¸Ä /etc/mysql/my.cnf Îļþ£¬
ÔÚ £Ûclient£Ý ϼÓÈë default-character-set=utf8,
ÔÚ [mysqld] ϼÓÈë default-character-set=utf8,
ÔòÔÚviÀï¿ÉÒÔÕýÈ·µÄÏÔʾÖÐÎÄÁË£¨Ç°ÌáÊÇviҲʹÓÃutf8£©¡£
²»¹ýÔÚ²éѯµÄʱºò£¬½á¹ûÀïµÄÖÐÎÄÈ´»áÏÔʾ³É "?"£¬Õâ¸öÎÊÌâ±È½Ï¼òµ¥µÄ·½·¨Óм¸ÖÖ£¬·Ö±ðÊÇ£º
1.ÔÚ´´½¨Ê ......
MySql°æ±¾£ºmysql-noinstall-5.1.43-win32
ϵͳ£ºVista
ÔÚC:\myProgram Files\mysql-5.1.43-win32£¨½âѹµÄĿ¼£©Ï½«Ñ¡Ò»¸öÅäÖÃÎļþ£¨my-small.ini£©±à¼£º
1.ÔÚ[client]ÏÂÌí¼Ó£º
default-character-set=utf8 ......