Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 리눅스
- pandas
- ubuntu
- MySQL
- python
- 맛집
- IOS
- 유니티
- GIT
- 다이어트
- 라즈베리파이
- tensorflow
- 함수
- port
- 날짜
- PyQt5
- flutter
- ASP
- MS-SQL
- sqlite
- Excel
- Linux
- PyQt
- swift
- javascript
- mssql
- Unity
- PER
- urllib
- node.js
Archives
아미(아름다운미소)
pymysql 설치 및 사용 본문
pymysql 설치
pip install PyMySQL예)
import pymysql
db = pymysql.connect(host='test.synology.me', port=3307, user='testid', passwd='testpw', db='testdb', charset='utf8')
try:
with db.cursor() as cursor:
sql = '''
CREATE TABLE TEST (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL,
model_num VARCHAR(10) NOT NULL,
model_type VARCHAR(10) NOT NULL,
PRIMARY KEY(id)
);
'''
cursor.execute(sql)
db.commit()
finally:
db.close()
'랭귀지 > python' 카테고리의 다른 글
| python round를 이용한 소수점 반올림 (0) | 2018.11.11 |
|---|---|
| not all arguments converted during string formatting (0) | 2018.11.10 |
| 판다(pandas)를 사용하여 현재 시간을 얻는 방법 (0) | 2018.11.08 |
| How to check the existence of a row in SQLite with Python? (0) | 2018.11.05 |
| [python] os.startfile Windows 특정 프로그램을 실행하는 방법 (0) | 2018.11.04 |
Comments