-
Python - MySQL 활용(PyMySQL)Python 2020. 5. 28. 17:56
Python - PyMySQL
MySQL Download
https://www.mysql.com/downloads/
MySQL :: MySQL Downloads
Contact MySQL | Login | Register The world's most popular open source database MySQL.com Downloads Documentation Developer Zone MySQL Enterprise Edition includes the most comprehensive set of advanced features and management tools for MySQL. MySQL
www.mysql.com
MySQL Client
MySQL Workbench
https://dev.mysql.com/downloads/workbench/
MySQL :: Download MySQL Workbench
Select Operating System: Select Operating System… Microsoft Windows Ubuntu Linux Red Hat Enterprise Linux / Oracle Linux Fedora macOS Source Code Select OS Version: All Windows (x86, 64-bit) Recommended Download: Other Downloads: Windows (x86, 64-bit), M
dev.mysql.com
phpMyAdmin – AutoSet Download
-
웹서버에서 실행 가능
오토셋 소개
AutoSet 유지보수 종료 안내 1. 오토셋에 대한 유지보수 계획이 없기에 사용자분들께 이 내용을 알려드립니다. 2. 현재 사이트를 통해 제공되는 버전이 최종 버전이며, 더 이상의 업그레이드가 없��
autoset.net
Python 에서 MySql 연결
PyMySQL
https://pymysql.readthedocs.io/en/latest/
Welcome to PyMySQL’s documentation! — PyMySQL 0.7.2 documentation
© Copyright 2016, Yutaka Matsubara and GitHub contributors Revision d8957193.
pymysql.readthedocs.io
PyMySQL 모듈 설치
pip install PyMySQL
PyMySQL 모듈 확인
설정에서 PyMySQL설치 확인 Python에서 PyMySQL 사용하는 일반적인 절차
-
pymysql 모듈을 import
-
pymysql.connect() 메소드를 사용하여 MYSQL에 Connect
-
호스트명, 로그인, 암호, 접속할 DB 등을 파라미터로 지정
-
DB 접속이 성공하면, Connection 객체로부터 cursor() 메서드를 호출
-
Cursor 객체의 메서드를 통해 MYSQL 서버와 작업 관리
-
Cursor 객체의 execute() 메서드를 사용하여 SQL 문장을 DB 서버로 전송
-
SQL 쿼리의 경우 Cursor 객체의 fetchall(), fetchone(), fetchmany() 등의 메서드를 사용
-
데이타를 서버로부터 가져온 후, Fetch 된 데이타를 사용
-
Insert, Update, Delete 등의 DML(Data Manipulation Language) 문장을 실행
-
Connection 객체 commit() 은 실제로 DML 문장을 서버에 실제 실행
-
Connection 객체 rollback() 실행 으로 DML 문장 취소
-
Connection 객체의 close() 메서드를 사용하여 DB 연결 닫기
Step 0. Create Table
-
mysql client로 서버 접속
-
테이블 생성 및 테스트용 데이터 Insert
Step 1. Connect & Execute query
'Python' 카테고리의 다른 글
Python - Sqlite3 활용 (0) 2020.05.29 Python - JSON 활용 (0) 2020.05.29 Python - CSV 활용 (0) 2020.05.28 Python - MSSQL 활용(Pymssql) (0) 2020.05.28 Python 기본문법 (0) 2020.05.28 -