2018-08-06數(shù)據(jù)庫命令

1.show databases; //顯示所有數(shù)據(jù)庫
2.mysql> use mysql; //切換當(dāng)前數(shù)據(jù)庫
3.mysql> show tables; //顯示當(dāng)前數(shù)據(jù)庫所有表
4.mysql> desc user; //顯示當(dāng)前表的所有字段

  1. mysql> select Host,User from user; //查詢表記錄
    6.mysql -h IP地址 -u test -p //登錄數(shù)據(jù)庫
    7.GRANT all privileges ON . TO ‘test’@’%’ IDENTIFIED BY ‘123456’;
    創(chuàng)建一個訪問mysql數(shù)據(jù)庫賬號
    8.mysql> create database //創(chuàng)建數(shù)據(jù)庫
    9.DROP DATABASE 數(shù)據(jù)庫名;刪除數(shù)據(jù)庫
  2. 創(chuàng)建學(xué)生表 student
    CREATE TABLE student( number int()
    name varchar()
    age int()
    );

11.1刪除表
mysql> DROP TABLE coures;

12.插入一條記錄
mysql> INSERT INTO student (number,name,age)VALUES(1001,'小明',23);

13.查詢語句
SELECT * FROM student;

14.修改記錄
mysql> UPDATE student SET name='張三' WHERE number=1001;

15.刪除記錄

mysql> DELETE FROM student WHERE name='李四';

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容