MySQL之旅 建立資料庫 資料表 插入資料 MySQL視覺化工具Navicat for MySQL
阿新 • • 發佈:2021-06-25
導言:若木有安裝破解版Navicat for MySQL軟甲,傳送門已備好--->傳送門:安裝破解版Navicat
第一步:視覺化工具Navicat for MySQL連線MySQL
1·啟動MySQL
npm指令--切換目錄:
cd C:\web\mysql-8.0.11\bin
npm指令--初始化資料庫:
mysqld --initialize --console
執行完成後,會輸出 root 使用者的初始預設密碼:
... 2018-04-20T02:35:05.464644Z 5 [Note] [MY-010454] [Server] A temporary password is generated forroot@localhost: APWCY5ws&hjQ ...
npm指令--安裝 :
mysqld install
npm指令--啟動:
net start mysql
2· 連線Navicat for MySQL
第二步:連線成功 建立資料庫 右擊Navicat左側開啟命令列介面
tips:因為我自己MySQL前一秒寫資料了 並不影響 ;
1· 建立資料庫指令:
CREATE DATABASE 資料庫名;
2· 使用資料庫(切記 每次完整的命令結尾用 ';'):
use 資料庫名;
3·資料庫建立表單(表格):
mysql> create table Fruits (-> id int(11), -> name VARCHAR(255), -> price DECIMAL(10,2), -> discount DECIMAL(10,2), -> manufacturer VARCHAR(255), -> shop VARCHAR(255), -> shopname VARCHAR(255), -> incorporation DATE, -> operationstatus tinyint(1), -> shopbox VARCHAR(255),-> address VARCHAR(255), -> onlinephone int(11) -> );
tips: 每行指令字首 -> 是Navicat自帶分行 別搞錯了, Query OK, 0 rows affected 表示建立成功!
4·顯示你所建立的表單 table :
show full columns from fruits;
:顯示結果
+-----------------+---------------+--------------------+------+-----+---------+-------+---------------------------------+---------+ | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | +-----------------+---------------+--------------------+------+-----+---------+-------+---------------------------------+---------+ | id | int | NULL | YES | | NULL | | select,insert,update,references | | | name | varchar(255) | utf8mb4_0900_ai_ci | YES | | NULL | | select,insert,update,references | | | price | decimal(10,2) | NULL | YES | | NULL | | select,insert,update,references | | | discount | decimal(10,2) | NULL | YES | | NULL | | select,insert,update,references | | | manufacturer | varchar(255) | utf8mb4_0900_ai_ci | YES | | NULL | | select,insert,update,references | | | shop | varchar(255) | utf8mb4_0900_ai_ci | YES | | NULL | | select,insert,update,references | | | shopname | varchar(255) | utf8mb4_0900_ai_ci | YES | | NULL | | select,insert,update,references | | | incorporation | date | NULL | YES | | NULL | | select,insert,update,references | | | operationstatus | tinyint(1) | NULL | YES | | NULL | | select,insert,update,references | | | shopbox | varchar(255) | utf8mb4_0900_ai_ci | YES | | NULL | | select,insert,update,references | | | address | varchar(255) | utf8mb4_0900_ai_ci | YES | | NULL | | select,insert,update,references | | | onlinephone | int | NULL | YES | | NULL | | select,insert,update,references | | +-----------------+---------------+--------------------+------+-----+---------+-------+---------------------------------+---------+ 12 rows in set
5·給表單出入資料 可插入多條資料:
insert into tablename (...所要插入的引數) values (...所要插入的值)
forexample:
insert into fruits (id,name,price,discount,manufacturer,shop,shopname,incorporation,operationstatus,shopbox,address,onlinephone)
-> values ('15','iphone 8','1000.99','990.88','浙江義烏','義烏數碼科技市場','iPhone體驗店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'), ('16','iphone 8Plus','1070.99','919.88','浙江義烏','義烏數碼科技市場','iPhone店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'),('17','ipone SE','1000.99','990.88','浙江義烏','義烏數碼科技市場','iPhone店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'), ('18','iphone SE2','1070.99','919.88','浙江義烏','義烏數碼科技市場','iPhone店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'),('19','iphone Max','1000.99','990.88','浙江義烏','義烏數碼科技市場','iPhone店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'), ('20','vivo','1070.99','919.88','浙江義烏','義烏數碼科技市場','iPhone店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'),('21','HUAWEI','1000.99','990.88','浙江義烏','義烏數碼科技市場','華為體驗店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'), ('22','vivo','1070.99','919.88','浙江義烏','義烏數碼科技市場','vivo體驗店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'),('23','HUAWEI','1000.99','990.88','浙江義烏','義烏數碼科技市場','華為體驗店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820'), ('24','vivo','1070.99','919.88','浙江義烏','義烏數碼科技市場','vivo體驗店','2010-10-01','1','小丫丫','陝西西安雁塔','082088820');
tips: 顯示
Query OK, 10 rows affected
Records: 10 Duplicates: 0 Warnings: 0
表示資料成功;
end...