##刪除表
drop
table h_data;
##建立表
create
table
ifnot
exists h_data(
hotel varchar
(100
)not
null
,is_canceled int(30
)not
null
,lead_time int
(100
)not
null
,arrival_date_year year
notnull
,arrival_date_month varchar(50
)not
null
,arrival_date_week_number int(30
)not
null
,arrival_date_day_of_month int(30
)not
null
,stays_in_weekend_nights int(30
)not
null
,stays_in_week_nights int(30
)not
null
,adults int(30
)not
null
,children int(30
)not
null
,babies int(30
)not
null
,meal varchar(30
)not
null
,country varchar(30
)not
null
,market_segment varchar
(100
)not
null
,distribution_channel varchar
(100
)not
null
,is_repeated_guest int(30
)not
null
,previous_cancellations int(30
)not
null
,previous_bookings_not_canceled int(30
)not
null
,reserved_room_type varchar(30
)not
null
,assigned_room_type varchar(30
)not
null
,booking_changes int(30
)not
null
,deposit_type varchar
(100
)not
null
,agent int
(100
)null
,company int
(100
)null
,days_in_waiting_list int(30
)not
null
,customer_type varchar
(100
)not
null
,adr double
notnull
,required_car_parking_spaces int(30
)not
null
,total_of_special_requests int(30
)not
null
,reservation_status varchar
(100
)not
null
,reservation_status_date date
,primary
key(hotel)
)engine
=innodb
default
charset
=utf8;
##匯入表
load
data
infile
'/var/lib/mysql-files/hotel_bookings.csv'
into
table h_data
fields
terminated
by','
optionally
enclosed
by'"'
escaped
by'"'
lines
terminated
by'\r\n'
;##重啟mysql服務
sudo service mysql restart
error 1366 (hy000): incorrect integer value: 『is_canceled』 for column 『is_canceled』 at row 1
官方解釋:在5.x版本的mysql對空值插入有」bug」,要在安裝mysql的時候去除預設勾選的enable strict sql mode,如果我們安裝好了mysql,解決辦法是更改mysql中的配置 my.ini
my.ini中查詢sql-mode,
預設為:sql-mode=」strict_trans_tables,no_auto_create_user,no_engine_substitution」,將其修改為
sql-mode=no_auto_create_user,no_engine_substitution
重啟mysql後即可
由於執行的環境是在ubuntu18.06系統下,在terminal終端進行的操作,需要找到配置my.cnf檔案;
my.cnf檔案內只有
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
找到mysql.conf.d內的mysqld.cnf,在文段末尾加上
sql
-mode
=no_auto_create_user,no_engine_substitution
並將整段mysqld.cnf複製新增到一開始的my.cnf檔案內,問題解決! ubuntu1804下的thinkcmf環境搭建
一 所需軟體 mysql apache php7.2 thinkcmf 二 安裝mysql sudo apt get install mysql server mysql common mysql client 安裝 sudo mysql u root 以root登陸,必須增加使用者,不然登陸不進m...
ubuntu18 04下安裝MongoDB步驟
1.第1步 匯入公鑰 ubuntu軟體包管理器apt 高階軟體包工具 需要軟體分銷商的gpg金鑰來確保軟體包的一致性和真實性。執行此命令將mongodb金鑰匯入到伺服器。sudo apt key adv keyserver hkp recv 2930adae8caf5059ee73bb4b58712...
ubuntu18 04下的BHuman安裝
最近加入了學校的robotcup機械人隊,需要安裝bhuman環境,因此寫了本篇部落格來分享一下配置bhuman的過程。需要準備的庫 sudo apt install clang qtbase5 dev libqt5svg5 dev libglew dev libxml2 dev graphviz ...