不知道少了什麼,總覺得沒有以前快樂,不後悔遇見誰,只後悔變成現在的模樣。。。
---- 網易雲熱評
一、環境安裝
PHPstudy下載地址,一路下一步,安裝的時候路徑不要有中文或者空格
https://www.xp.cn/download.html
二、操作mysql資料庫
1、透過命令啟動,進入mysql安裝目錄,C:\phpstudy_pro\Extensions\MySQL5.7.26\bin,按著shift,右擊滑鼠,開啟DOS視窗
連線資料庫:mysql -uroot -proot
2、透過PHPmyadmin連線資料庫
三、資料庫相關查詢命令
1、show databases;預設有4個數據庫
2、create database aiyou; 建立資料庫
3、use aiyou; 選擇要操作的資料庫
4、select database();檢視當前資料庫
6、exit 退出
四、在資料庫中新增表
1、新建表
create table 專輯(序號 int(4) auto_increment,
專輯名稱 varchar(100) not null,
主打歌 varchar(100) not null,
發行時間 date not null,
primary key(序號)
);
2、desc 專輯; 查看錶的結構
3、show tables 顯示目前存在的表名
4、表的相關操作
alter table 專輯 rename 專屬; 修改表名
alter table 專輯 modify 主打歌 varchar(55); 修改欄位資料型別
alter table 專輯 change 序號 id int(2); 修改欄位名字和屬性
alter table 專輯 add 作詞 varchar(100) not null after 主打歌;
禁止非法,後果自負