mysql 的一些命令 mysql常用的命令

2021-10-17 20:15:16 字數 460 閱讀 4765

檢視資料庫中所有的表:show tables;檢視指定表的建立結構:show create table 表名;檢視指定表結構:desc 表名;刪除表:drop table 表名;

下面的語句,盡量不要出現:修改表的語句:新增列:alter table 表名 add 欄位名  型別;修改字段型別:alter table 表名  modify 欄位名 型別;修改表的列名:alter table 表名  change  舊列名 新列名 型別;刪除列:alter table 表名 drop 欄位名;修改表名:alter table 表名 rename to 新錶名;

dml語句:插入語法:方式一:insert into 表名(欄位1,欄位2???)values(值1,值2,???);在資料庫中字串型別用『 』單引號表示。方式二:insert into 表名 values(值1,值2???);備註:如果表名後不跟指定列名,那麼賦值的時候必須一一都要複製,不允許任何乙個不賦值

MySQL一些命令

1 使用show語句找出在伺服器上當前存在什麼資料庫 mysql show databases 2 2 建立乙個資料庫mysqldata mysql create database mysqldata drop database mydb 3 選擇你所建立的資料庫 mysql use mysqlda...

mysql一些命令 mysql常用的一些命令

一 授權登入 參考grant all privileges on cacti.to hnf localhost identified by hnf 2014 只給cacti這個資料庫授權 grant all on to root localhost identified by huningfei 只...

mysql的一些命令

windows使用者 要這麼載入多條資料 mysql load data local infile path pet.txt into table pet lines terminated by r n txt檔案寫法 空值的用 n代替,每個值之間用tab隔開 fluffy harold cat f...