學習Mysql 二 常用指令

2022-05-05 08:03:10 字數 649 閱讀 8424

環境搭建ok。視覺化檢視看得我一臉懵逼,還是命令列學習下。

常用指令:

1. 登入:

mysql -h 主機名 -u 使用者名稱 -p

注:本機localhost的話,-h部分可以省略。-p後面不寫密碼的話,等待命令列提示輸入密碼後再輸入。或者直接寫出來密碼,此時-p緊接著密碼,沒空格:

mysql -u root -p123456

2.檢視現有的資料庫:

show databases;

注:分號;必須有

mysql> show databases;

+--------------------+

| database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sakila |

| sys |

| world |

+--------------------+

3.建立資料庫

create database mydatabasename;

mysql學習筆記(二) 常用指令

1 建立資料庫 create database zh 2 顯示資料庫 show databases 3 使用資料庫zh 即進入了zh use zh 4 顯示資料庫zh中的表 show tables 5 在資料庫zh中檢視資料庫employees中的表 show tables from employe...

mysql常用指令 Mysql常用指令

mysql常用指令2021 01 19 23 40 45 作用 去除select 查詢出來的結果中重複的資料,重複資料只展示一列.關鍵字 distinct 用法 select distinct source from student table source 去重的字段條件 student tabl...

mysql手機指令 MySQL常用指令

mysql相關指令 資料庫排序規則 常用utf8 general ci 1cmd連線資料庫 1.版本檢視 mysqladmin version 2.連線root mysql u root p,輸入密碼 退出ctrl c 或quit 2查詢資料庫 show databases 3查詢資料表 show ...