MySQL增刪改查--之查

來源:互聯網
上載者:User

標籤:MySQL查看資料

MySQL查看資料1、顯示當前所有資料庫名

show databases;

2、顯示當前所在資料庫

select database();

3、顯示當前資料庫的所有表

show tables;

4、查詢表中所有記錄(兩種方式)

(1)在user表當前路徑查詢user表 select * from 表名;

(2)不在user表當前路徑並指定路徑查詢user表 select * from 庫名.表名;

5、更改表欄位類型(兩種方式)(欄位也就是字元長度)

(1)在當前user表路徑下更改欄位類型
alter table 表名 modify column 欄位名 類型;

(2)不在當前user表路徑下並指定路徑更改欄位類型
alter table 庫名.表名 modify column 欄位名 類型;

6、查詢表結構(兩種方式)

(1)在當前user表路徑下查詢表結構

(2)不在當前user表路徑下並指定路徑查詢表結構

7、查詢當前資料庫所有已存在使用者

select Host,User,Password from mysql.user;

8、使用hehe使用者登入資料庫;-h指定登入主機


註:MySQL增加Tab功能
//編輯MySQL設定檔 vim /etc/my.cnf

//重啟mysqld服務 /etc/init.d/mysqld restart

9、查詢資料庫分別使用的是什麼語言

mysql> show variables like ‘%char%‘;

10、查詢MySQL資料庫的二進位檔案

11、查看當前資料庫所支援的儲存引擎

mysql> show engines;

12、查看錶使用的儲存引擎

mysql>show table status from 庫名 where name=‘表名‘\G;

13、查看建立表時結構

mysql> show create table 表名\G;

註:mysql_convert_table_format命令只能從InnoDB引擎改為MyISAM

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.