debianÏÂmysql¶ÔÖÐÎĵÄÖ§³ÖÎÊÌâ
ÐÞ¸Ä /etc/mysql/my.cnf Îļþ£¬
ÔÚ £Ûclient£Ý ϼÓÈë default-character-set=utf8,
ÔÚ [mysqld] ϼÓÈë default-character-set=utf8,
ÔòÔÚviÀï¿ÉÒÔÕýÈ·µÄÏÔʾÖÐÎÄÁË£¨Ç°ÌáÊÇviҲʹÓÃutf8£©¡£
²»¹ýÔÚ²éѯµÄʱºò£¬½á¹ûÀïµÄÖÐÎÄÈ´»áÏÔʾ³É "?"£¬Õâ¸öÎÊÌâ±È½Ï¼òµ¥µÄ·½·¨Óм¸ÖÖ£¬·Ö±ðÊÇ£º
1.ÔÚ´´½¨Êý¾Ý¿âʱ¼´Ö¸¶¨Êý¾Ý¿â×Ö·û¼¯(»¹¿ÉÒÔ˳´øÖ¸¶¨Ð£¶Ô¹æÔò)£º
mysql> CREATE DATABASE
db_name
mysql> DEFAULT CHARACTER SET utf8 £Û
COLLATE utf8
£Ý;
2.ÔÚ´´½¨±íµÄʱºòÖ¸¶¨±í×Ö·û¼¯£º
mysql> CREATE TABLE
tbl_name
(
column_list
)
mysql> DEFAULT CHARACTER SET
charset_name
COLLATE
collation_name
3.Ö¸¶¨ÁÐ×Ö·û¼¯(ÿһ¸ö“×Ö·û
”ÁУ¨¼´£¬CHAR
¡¢VARCHAR
»òTEXT
ÀàÐ͵ÄÁУ©ÓÐÒ»¸öÁÐ×Ö·û¼¯ºÍÒ»¸öÁÐ
У¶Ô¹æÔò£¬Ëü²»ÄÜΪ
¿Õ¡£Áж¨ÒåÓï·¨ÓÐÒ»¸ö¿ÉÑ¡×Ó¾äÀ´Ö¸¶¨ÁÐ×Ö·û¼¯ºÍУ¶Ô¹æÔò)£º
mysql> CREATE TABLE Table1
mysql> (
mysql> column1 VARCHAR(5)
CHARACTER SET latin1 COLLATE latin1_german1_ci
mysql> );
Ïà¹ØÎĵµ£º
***function(/*³£Óú¯Êý*/)***
----ͳ¼Æº¯Êý----
AVG --Çóƽ¾ùÖµ
COUNT --ͳ¼ÆÊýÄ¿
MAX --Çó×î´óÖµ
MIN --Çó×îСֵ
SUM --ÇóºÍ
--AVG
use pangu
select avg(e_wage) as dept_avgWage
from employee
group by dept_id
--M ......
MySqlÊý¾Ý¿âµ¼³öcsvÎļþÃüÁ
mysql> select first_name,last_name,email from account into outfile 'e:\\output1.csv' fields terminated by ','optionally enclosed by ''lines terminated by '\n';
csvÎļþЧ¹û£º
sunny
Grigoryan
lovechoosesun@gmail.com
Jon
Siegal
sun@riliantech.net
Joe
S ......
http://javeye.javaeye.com/blog/558093
ÎÒÃÇÖªµÀ£¬group by¿ÉÒÔ½«sql²éѯ½á¹û°´ÕÕgroup byºóÃæÁнøÐзÖÀàÏÔʾ¡£±ÈÈ磺
Sql´úÂë
select
columnA,columnB
from
table
group
by
columnA,columnB
select columnA,columnB from table group by columnA,colum ......
½ñÌìµ½mysqlÍøÕ¾¿´¿´·¢ÏÖûÓÐÁËsun LOGO£¬Ò²ÕÒ²»µ½mysql downloadsÏÂÔØÁ´½Ó
ÒªÊÖ¹¤´òÈëhttp://dev.mysql.com²ÅÐУ¬²»½ûÉÁ¹ýһ˿Á¹Ò⣬ÒÔÇ°¼á³ÖʹÓÃmysqlÏÖÔÚ»¹Òª¼á³ÖÂð£¬
ÒÔÇ°ÐÄÀïÒ»Ö±ÔÚÏëÒ»Ö±»áʹÓÃmysqlµÄ£¬µ«ÊÇÏÖÔڸоõµ½ºÜʧÍû£¬´ìÕÛ£¬½¹ÂÇ£¬²»ÖªÒÔºó»áÔõôÑù
×Ô¼º¼¸ÄêÀ´Ò»Ö±Ê¹ÓÃLAMP×éºÏ£¬ÖªÊ¶¶¼ÊÇÊÇΧÈÆ×ÅÕâ¸ö×éºÏ ......
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......