½T»{MySQL Using Connector/Python³s½u¦¨¥\
- ©«¤l
- 48
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-8-13
- ³Ì«áµn¿ý
- 2023-2-7
|
½T»{MySQL Using Connector/Python³s½u¦¨¥\
¦³Ãö Connecting to MySQL 5.6 Using Connector/Python¥i¥H°Ñ¦ÒMySQL Connector/Python Developer Guide¡A¦bChapter 5 Connector/Python Coding Examples¦³¡G
5.1 Connecting to MySQL Using Connector/Python
5.2 Creating Tables Using Connector/Python
5.3 Inserting Data Using Connector/Python
5.4 Querying Data Using Connector/Python
´N5.1 Connecting to MySQL Using Connector/Python³¡¥÷¡A»¡©ú¤å¥óÁö¦³´£¨Ñ½d¨Ò¡A¦ý§ÚÁÙ¬O¨Ì·Ó¦Û¤vªº»Ýn§@¨Çקï¡A©Î¥i¨Ñ«áÄòªº¤H°Ñ¦Ò¡A³s½u´ú¸Õ½d¨Òµ{¦¡¦p¤U¡G- import mysql.connector
- from mysql.connector import errorcode
- try:
- cnx = mysql.connector.connect(user='root', password='http://forum.twbts.com',
- host='127.0.0.1',
- database='world')
- except mysql.connector.Error as err:
- if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
- print("Something is wrong with your user name or password")
- elif err.errno == errorcode.ER_BAD_DB_ERROR:
- print("Database does not exists")
- else:
- print(err)
- exit(1)
- else:
- print("Congratulation! Your Connector/Python Installation is Verified.")
- cnx.close()
½Æ»s¥N½X |
|
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬OÓ¤p§¾«Ä¡I
|
|
|
|
|