Cs_mysql Interface With Python
Cs_mysql Interface With Python
2.
.
To CHuate
Ptlon
MysoL
a roject,
IDLE
you need thee sofoare
3.
ython MysoL Comectorn
Connect c) ue
pesuod
olatabasc
is useot to
Cuhson) Tuis metod
cunbor Object Aesponslble hon
Cheate
statements
to Communicat Lwill
execuctin9
cmnection byet.
cunboh cbject
to exe ute
Tis mnotuod is used
executec)
SAL statamant 4Oitten in Rytlon IDLE:
at
ualues
its bosition,
and tosent
blace holdeh . TLa
o Hue
placeholden
Aoocont)
more tie
object to dete
the etuns
nombe in Hue
executbon 9 te Statemnt.
auto commit
8. Auto Com mit Dys0L Con necton.
Thue oh falbe
ualue Can be
astigned false
ualue is
Bydfaul its
totuocg Data pkom Database
3
etele
hboh object.
Letches qiuen
more
ttion ows auailable in table
it etirHns all
nUm.
feehone
passd=
olatabase =
pecOnd cuhsOpetthonec)
brint e cand )
Fetchall
impont mysql. comectan esc
Con = C, con nect (host = localhos t eh 'Hoot
data base
pass od
econc=
dataBese =
cunsOn com, CunsOp )
impant
Con
my8ql
C.Connect
com
(
necton
host=
bassuind-
as
"localhos t"
"/23y'")
Cuh con, cunson)
"Cheate database tudon t"
con, cHBOrl)
CHate table studont dtails(
RolL Ao int phemauy key
Alaome uaHchatn(oo
manks loat(42)
cun.exeuite( Query)
bunt " Table Choate')
Con, commit)
Can check database
black wimdloo chock at
windlou.
desc command jetel ce able
stutra ion cle
tuple
tatle Atuctahe tn lylorn
Moo to show
ab c
tmpon mysgl, connedoh
wsdh= poot
Con= c,comnect (host = localhost
passuso hd"2.34!
=
data base "studant!
Con, cOmmit
Houw to
to mseht data Xong petn in le fable.
mport 'mysgl,commectot as c
tse=Msot" y2.341
passwoHol
olatalase = "suclont
pasusDtbd = "1234"
database "studnt)
Com, ch60b)
Loile Teei lo=)
nput En ton Roll
Roll Alo= bnt
eus,exeete (auey)
Com, co Mmit )