mysql相關操作 mysql 相關操作

2021-10-19 19:43:59 字數 817 閱讀 2122

1、登入: mysql -u root -p

2、檢視當前有的資料庫:show databases;

3、建立資料庫:create database 資料庫名;

4、操作(使用)資料庫:use 資料庫名;

5、檢視有哪些表:show tables;

6、建立表:create table 表名();

7、刪除表:drop table 表名;

8、檢視表結構:desc 表名;、show full columns from 表名;

9、檢視表索引:show index from 表名;

10、增加索引

1.primary  key(主鍵索引)

mysql>alter  table  `table_name`  add  primary  key (  `column`  )

2.unique(唯一索引)

mysql>alter  table  `table_name`  add  unique (`column` )

3.index(普通索引)

mysql>alter  table  `table_name`  add  index index_name (  `column`  )

4.fulltext(全文索引)

mysql>alter  table  `table_name`  add  fulltext ( `column` )

5.多列索引

mysql>alter  table  `table_name`  add  index index_name (  `column1`,  `column2`,  `column3`  )

mysql 的相關操作 mysql 相關操作

mysql u root p 回撤後輸入密碼 123456,進入mysql 資料庫簡單操作 1 建立資料庫 create database 資料庫名稱 2 檢視資料庫 show databases 3 刪除資料庫 drop database 資料庫名稱 4 開啟資料庫 use 資料庫名稱 資料表簡單...

mysql 的相關操作 MySQL相關操作知識

1 解決客戶端聯不上mysql伺服器的問題 grant all privileges on to root identified by with grant option flush privileges 2 登陸mysql mysql u root p 123456 3 檢視所有資料庫 show ...

mysql相關操作

1.遠端登入mysql mysql h ip u root p 密碼 2.建立使用者 格式 grant 許可權 on 資料庫.to 使用者名稱 登入主機 identified by 密碼 例1 增加乙個test1使用者,密碼為123456,可以在任何主機上登入,並對所有資料庫有查詢,增加,修改和刪除...