小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

mysql 安裝目錄及相關操作

 shangat 2010-04-11
登錄:[mysql@localhost~]$ sudo bin/mysql --port=3306 -u root -p -S /tmp/mysql.sock

install Doct include:                               windows
---------------------------------------
目錄              目錄內(nèi)容
-----------------------------------------
bin             客戶端程序和mysql服務器
data            日志文件 數(shù)據(jù)庫
docs            文檔
examples        示例程序和腳本
nclude          包含頭文件
lib             庫
scripts         實用工具腳本
share           錯誤消息文件
==========================
安裝后將會在以下系統(tǒng)目錄產(chǎn)生文件                           linux
---------------------------------------
/usr/bin                  客戶端程序和腳本
/usr/sbin                 mysql服務器
/var/lib/mysql            日志文件 數(shù)據(jù)庫
/usr/share/doc/packages   文檔
/usr/incude/mysql         包含頭文件
/usr/lib/mysql            庫
/usr/share/mysql          錯誤消息和字符文件
/usr/share/sql-bench      基準程序
--------------------------------
=======================操作==============================
 
 
   1. 創(chuàng)建/刪除數(shù)據(jù)庫:create/drop database xxx;
   2. 創(chuàng)建/刪除表:   create/drop table  xxx [valuse ()];
   3. 添加索引等:    create index on xxx (yyy);
   4. 復制表:        create table yyy select [*,y,z ]from xxx [where gggg];  此時表的結構類似  建立空表  在 where 中設置一個不存在的關系
                   create table like xxx;
   5. 修改表:  
       添加新字段  alter table xxx add xyz hfbi ;
       修改已存在的字段的名字和類型: alter table change  xxx yyy fdhjj;
       刪除字段: alter table xxx drop yhn;
       重命名: alter table xxx rename to yyy;   rename table xxx to yyy;
   6. 使用數(shù)據(jù):
       插入記錄:insert into xxx values ();
       更新記錄:update xxx set hgk=gjhau [where nuhgkji];
       刪除記錄:delect from xxx where jkhaurh;     當省略 where 時刪除所有記錄
       內(nèi)建函數(shù):select  sum() avg() now() from xxx [where jhak];   好像不能和字段在一塊查詢?
       別名 as 限制 limit 排序 orer by [asc  desc] 分組 group by
       使用變量: select @dfkb:=某操作結果   使用: select @dfkb; select fhu from xxx where bflb=@dfkb;
       復制記錄:insert into xxx [()] select jg,gh from yyy [where jha];
       批量數(shù)據(jù):load data local infile '/home/lvshang/....' into table xxx fields terminated by ',' lines terminated by '\n\;
       導出記錄:select gi,jghe from xxx [where fhfnk ] into outfile '/home/lvshang/yyyy' fields terminsted by ',' enclosed by
               '"' lines terminated by '\t\n';
 
  1.修改表的相關內(nèi)容的知識
   1.1
      alter table biao1 add clomname xxx;  追加新的字段
   1.2
      alter table biao1 drop clomname;     刪除原有的字段
   1.3
      alter table biao1 change clomname clomname_new xxx ;  改編字段的相關內(nèi)容
   1.4
      alter tbale biao1 modify clomname xxxx;  只是修改字段的類型等內(nèi)容,不改變字段的名字
   1.5
      alter table biao1 rename to name_new; rename table  biao1 to name_new;    均為重命名表明
   1.6
      alter table biao1 alter clomname set default xx/drop default   為一個字段設置或刪除默認值xx (數(shù)字),不常用
   1.7
      alter ignore table biao1 change clomname xxx unique;  將表的clomname 字段設置為不允許重復的出現(xiàn)。注意前面的 IGNORE
   1.8
      alter table biao1 type= xxx;  將表的類型改為 xxx .
   1.9
      alter table biao1 add fulltext index xxx; alter table biao1 drop index xxx;  增加/刪除索引
 
 2. 批量添加本地文件:
   load data local infile '/usr/lvshang/biaox' into table biaoy fields terminated by ',' lines terminated by '\n';
  

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多