mysql常用命令

來源:互聯網
上載者:User

標籤:mysql命令

  1. create database test_db; 建立名為test_db資料庫

  2. use test_db; 進入test_db資料庫

  3. show tables; 查看資料庫裡有多少張表

  4. drop database test_db ; 刪除資料庫

  5. drop table test01 ;  刪除表

  6. delete from test01 ; 清空表內容

  7. show variables like ‘%char%‘; 查看資料庫字元集

  8. insert into test01 values ("001","jf1"); 向表中插入資料。

  9. select * from test01; 查看test01表資料內容。

  10. create table test01 (id varchar(20),name varchar(20));

  11. grant all privileges on test_db.*  to  [email protected] identified by ‘123456‘;

  12. grant  all  on  test_db.*      to  [email protected] identified by ‘123456‘;

  13. grant  select,insert,update,delete on *.* to [email protected]”%”  identified by  ‘123456’;給mysql資料庫授權。

  14. flush  privileges;重新整理許可權

  15. mysqldump –uroot –p123456  test_db >/tmp/test.db.sql   ;MySQL備份或匯出

  16. mysql –uroot –p123456 test_db  < /tmp/test.db.sql        ;MySQL匯入

  17. mysqladmin –uroot –p123456 password   newpassword    ;修改MySQL root密碼

  18. drop database test_db ; 刪除資料庫

  19. drop table test01 ;  刪除表

  20. delete from test01 ; 清空表內容

  21. show variables like ‘%char%‘; 查看資料庫字元集

  22. insert into test01 values ("001","wugk1"); 向表中插入資料。

  23. select * from test01; 查看test01表資料內容。

  24. create table test01 (id varchar(20),name varchar(20));

  25. alter table ip_can  drop id;刪除某一欄位
    alter table ip_can add id varchar(20);增加某一欄位
    alter table ip_can add id varchar(20) first;增加欄位在第一行

後續持續更新中

本文出自 “毛毛鴨” 部落格,請務必保留此出處http://woshitieren.blog.51cto.com/2466034/1681211

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.