mysql 常用語句集

2021-09-06 15:44:07 字數 647 閱讀 5383

1、查詢某資料庫大小語句: select concat(round(sum(data_length/1024/1024),2),'mb') as data  from tables where table_schema='yxl'; --table_schema等於資料庫。

2、查詢某資料庫某錶大小語句: select concat(round(sum(data_length/1024/1024),2),'mb') as data,table_name  from tables where table_schema='yxl' and table_name='pf_user_info'; --table_schema等於資料庫。table_name等於表名。

3、查詢所有庫大小語句: select concat(round(sum(data_length/1024/1024),2),'mb') as data  from tables;

4、檢視某乙個庫,所有表的大小情況: select table_name,table_rows,data_length/1024/1024 "data_length",create_time,table_collation from information_schema.tables where table_schema = 'yxl' order by table_rows desc

MySQL常用語句集

登入mysql mysql h ip u account p password 若 h選項無指定,則預設為本機 localhost 127.0.0.1 建立資料庫 create database name 刪除資料庫 drop database name 選擇資料庫 use name 建立資料表 建...

mysql常用語句 MySQL常用語句

create table student id int primary key auto increment comment 學號 name varchar 200 comment 姓名 age int comment 年齡 comment 學生資訊 修改表注釋 alter table studen...

php mysql 常用語句 mysql常用語句

一 修改mysql使用者密碼 mysql h localhost u root p 命令列登入 update user set password password 123456 where user root 二 資料庫操作 show databases 顯示資料庫 create database ...