mysql常用的指令(檢視資料庫,版本等)

2021-10-07 11:16:35 字數 781 閱讀 4492

show databases;

use 資料庫名稱;

show tables;

select database();

select version();

show tables from 資料庫名;

create database 資料庫 charset utf8;

show create database 資料庫名;

drop database 資料庫名;

drop database if exists 資料庫名;

create user 『root』@』%』 identified by 『密碼』;

grant all privileges on . to 『root』@』%』;

然後查詢select host, user, authentication_string, plugin from user

可以看到有兩條user是root的記錄,host分別位%和localhost

mysql的語法規範

1.不區分大小寫,建議關鍵字大寫,表名、列名小寫

2. 每條命令用分號結尾

3. 注釋:

單行注釋: #注釋名字

單行注釋:-- 注釋文字

多行注釋: /注釋文字/

檢視資料庫mysql指令集

說明 為必須指定該物件 為可選項 為必選項 檢視mysql資料庫預設編碼 show variables like char 檢視當前資料庫編碼 show create database 資料庫名 檢視當前資料庫下資料表的編碼 show create table 表名 檢視指定資料表的編碼 show ...

mysql檢視 MySQL檢視當前資料庫庫

mysql檢視當前資料庫庫 1 在mysql下檢視當前使用的是哪個資料庫,有三種方式 用select database 語句 mysql select database database test row in set 0.00 sec 從查詢結果中可以看出,當前用的是test資料庫 2 用show...

MySQL 檢視資料庫

對於當前資料庫的情況,例如資料庫大小 字符集 使用者等等,可以通過檢視資料庫的操作實現!登入資料庫之後,當我們看到mysql 就可以 1.檢視所有的資料庫 show databases 將檢視到已經建立的資料庫,如下 2.檢視資料庫定義的語句 3.檢視當前使用的資料庫 4.檢視資料庫使用的埠 5.檢...