1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      MySQL常用語法

      MySQL常用語法數(shù)據(jù)庫級別操作

      創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務,包含不限于網(wǎng)站設計制作、網(wǎng)站建設、定南網(wǎng)絡推廣、小程序設計、定南網(wǎng)絡營銷、定南企業(yè)策劃、定南品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)為所有大學生創(chuàng)業(yè)者提供定南建站搭建服務,24小時服務熱線:18982081108,官方網(wǎng)址:www.cdcxhl.com

      #查看有哪些數(shù)據(jù)庫
      show databases; 
      
      #創(chuàng)建數(shù)據(jù)庫
      create database 【數(shù)據(jù)庫名字】; 
      
      #顯示數(shù)據(jù)庫的字符集
      show create database 【數(shù)據(jù)庫名字】; 
      
      #字符集不一致時導致數(shù)據(jù)庫亂碼的罪魁禍首,使用help create database還可以看到校對規(guī)則。
      create database 【數(shù)據(jù)庫】 default character set【字符集,如utf8,gbk】;
      
      #刪除數(shù)據(jù)庫
      drop database 【數(shù)據(jù)庫】;
      
      #切換數(shù)據(jù)庫
      use 【數(shù)據(jù)庫】;
      
      #查看當前數(shù)據(jù)庫
      select database(); 
      
      #查看有哪些表
      show tables;
      
      #顯示指定數(shù)據(jù)庫的表
      show tables from 【數(shù)據(jù)庫】;



      用戶管理設置密碼

      #創(chuàng)建用戶
      create user '用戶'@'主機域';
      
      #設置密碼
      set password for '用戶'@'主機域' = password('密碼');
      
      #創(chuàng)建用戶
      create user '用戶'@'主機域' identified by '密碼';
      
      #刪除系統(tǒng)多余賬戶
      drop user '用戶名'@'主機域'; 
      
      #刪除指定用戶
      delete from MySQL.user where user='用戶' and host='主機域';
      
      #刷新更新
      flush privileges;

      賦予收回權(quán)限

      #授權(quán)
      grant all on 【數(shù)據(jù)庫】.【*或表】 to '用戶'@'主機域';
      
      #所有權(quán)限,可單獨給usage連接,主要select,create,update,insert,delete。
      grant all privileges on 【數(shù)據(jù)庫】 to '用戶'@'主機域';
      
      #查看該用戶的權(quán)限
      show grants for 用戶@主機域;
      
      #收回權(quán)限
      revoke 【權(quán)限】 on 【數(shù)據(jù)庫】.【*或表】 from 用戶@主機域;

      表操作

      #新建表
      create table test (字段1 類型(數(shù)) 參數(shù)1,2.. comment ‘中文注釋’,字段2 類型(數(shù)) 參數(shù)1,2..);
      
      #類型:int 整數(shù),double 雙精度浮點型,char 定長字符串優(yōu)化效率,varchar 變長字符串,date 日期型
      #參數(shù):primary key主鍵,not null不為空,auto_increment自動增長
      
      #查看表的結(jié)構(gòu)
      desc 【表】;
      
      #顯示建立這個表的語句
      show create table 【表】; 
      
      #插入記錄
      insert into 【表】(【字段1】,【字段2】) values(【值1】,【值2】), (【值1】,【值2】)…;
      
      #若沒寫字段則按照表里面字段的順序來,可同時插入需多條,一次插入多條屬于優(yōu)化。

      查詢記錄

      select 【列名】 from 【表】 where 【字段】='【%可匹配任意】';
      
      #查看表
      select * from test; 
      
      #查看前兩行
      select * from test limit 2; 
      
      #從第二行開始查接下來的兩行
      select * from test limit 2,3;
      
      #id降序【asc升序】排列再查前兩行
      select * from test order by id desc limit 2; 
      
      #范圍查詢
      select * from test where id >2 and【or】 id<4; 
      
      #多表查詢
      select t1.id t1.name t2.age from t1,t2 where t1.name=t2.name and t1.name='zhangsan';

      更新數(shù)據(jù)

      #更新記錄:要跟where,不然就掛了
      update 【表】 set 【列】=【值】 where 【列】='【值】';
      
      #刪除記錄:要跟where,不然就掛了
      delete from 【表名】 where id >3;
      
      #清空數(shù)據(jù)
      truncate table 【表】;
      
      #插入字段
      alter table 【表】 add 【字段名】 【類型參數(shù)】 after 【字段】;
      add添加,change改變,drop刪除
      
      #更改表名
      rename table 【原表名】 to 【改名】;

      網(wǎng)頁標題:MySQL常用語法
      當前URL:http://ef60e0e.cn/article/podscs.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        遵义县| 邹城市| 双流县| 石渠县| 拜泉县| 应城市| 泗洪县| 石柱| 安岳县| 平和县| 喜德县| 金昌市| 瑞丽市| 南投县| 镇雄县| 金堂县| 江北区| 禹城市| 珲春市| 北川| 朝阳市| 南昌市| 儋州市| 南华县| 潮安县| 丹凤县| 大同市| 赫章县| 滨州市| 若尔盖县| 张家界市| 湖口县| 邵东县| 丘北县| 交城县| 松原市| 杭锦后旗| 利川市| 札达县| 兴宁市| 涡阳县|