mysql基本命令

2021-09-02 17:39:07 字數 1050 閱讀 8048

登入:mysql -uroot -p

顯示所有資料庫: show databases;

使用資料庫: use qiu1;

顯示表: show tables;

查詢表中所有記錄:select * from qiu1;

查詢某一類的記錄:select 某欄位 from qiu1 where name="條件約束";

查詢某一類的記錄(模糊匹配):select 某欄位 from qiu1 where name like "條件約束%";

查詢表中所有關於qiu記錄:select * from qiu1 where name="qiu";

取消所有命令: \c

退出mysql: exit;

新建使用者:grant all on qiu1.* to "user"@"127.0.0.1" identified by "123456";

建立資料庫: create database qiu2;

建立表:create table student(id int(10) primary key auto increment,name varchar(10),score int(2));

檢視表的結構: desc student;

插入資料:insert into student (id,name,score) values(25874,"zhangsan",98);

刪除資料庫: drop database qiu2;

執行外部檔案的命令: source 檔名.sql

字符集:default character set utf8

顯示版本資訊:select version();

顯示當前使用的庫: select database();

更新資訊:update student set name="me" where id=5;  //注意:如果不指定,則所有資訊都會被更改

限制資料的數量:select * from student limit 2 order by id; //limit 關鍵字limit限制數量;order by 排序先排序,再擷取

mysql基本命令總結 mysql基本命令總結

1.在ubuntu上安裝mysql sudo apt get install mysql server sudo apt get install mysql client 2.安裝結束後,用命令驗證是否安裝並啟動成功 sudo netstat tap grep mysql 通過上述命令檢查之後,如果...

mysql基本命令

第一招 mysql服務的啟動和停止 net stop mysql net start mysql 第二招 登陸mysql 語法如下 mysql u使用者名稱 p使用者密碼 鍵入命令mysql uroot p,回車後提示你輸入密碼,輸入12345,然後回車即可進入到mysql中了,mysql的提示符是...

mysql 基本命令

第一招 mysql服務的啟動和停止 net stop mysql net start mysql 第二招 登陸mysql 語法如下 mysql u使用者名稱 p使用者密碼 鍵入命令mysql uroot p,回車後提示你輸入密碼,輸入12345,然後回車即可進入到mysql中了,mysql的提示符是...