mysql常用操作

來源:互聯網
上載者:User

標籤:mysql   grant   select   drop   update..   

    show databases;   查看都有哪些庫 

    use db; show tables;  查看某個庫的表

    desc tb;  查看錶的欄位 

    show create table tb\G;  查看建表語句

    selectuser();  當前是哪個使用者

    select database();  當前庫

    select version();  查看資料庫版本

    showstatus;  查看mysql狀態

          

    set global max_connect_errors = 1000;  修改mysql參數

    show processlist;  查看mysql隊列

    grantall on *.* to user1 identified by ‘123456‘;  建立普通使用者並授權 

    grant all on db1.* to ‘user2‘@‘10.0.2.100‘ identified by‘111222‘;

    grant all on db1.* to ‘user3‘@‘%‘ identified by ‘231222‘;  (百分比符號‘%’表示通配)


    select * from tb1\G;   查詢                   

    update tb1 set id=5 where name=’55’;   更新資料

    truncate table aming.tb1;    清空表(庫名.表名)        

    delete from tb1 where name=’55’;   刪除指定行

    drop table tb1;    刪除表                     

    drop database db1;    刪除資料庫              

    repair table db1.tb1;  修複表  


本文出自 “linux營運” 部落格,請務必保留此出處http://zhumy.blog.51cto.com/11647651/1793831

mysql常用操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.