一、輸入查詢:
select version();獲取版本信息;
select current_date;返回當前日期;
select now();返回當前時間;
select user();返回鏈接的用戶;
二、創建並使用數據庫:
1、在unix下,數據庫名和表名區分大小寫,所以最好在代碼中嚴格使用一樣的名字;
2、鏈接數據庫時,-p輸入密碼,-p後面不能有空格;
三、將數據插入到表中:
(1)load data方式:
1、非windows中,load data local infile "文件路徑及名稱" into table 表名;
2、windows中,load data local infile "文件路徑及名稱" into table 表名 lines terminated by '\r\n';
3、運用在OS X的apple機上,行結束符爲“\r”;
(2)insert into方式:略;
四、常用查詢例子:
1、last_insert_id()方法返回auto_increament自動最大值;
五、孿生項目:略;
六、和Apache一起使用mysql:略;