What is the process of using MySQL from Python on Windows?

I come from a PHP background where MySQL works easily with PHP, and does not try to get MySQL to work with Python. Of all the research I have done and reading similar, but not exact, questions, it seems to me that there are different ways to achieve this, which makes my head even more difficult. So far I have installed MySQL-python-1.2.3 for python 2.7.1 on Windows XP 32Bit. Can someone give me an overview of what is needed in order to get MySQL to work with Python on Windows or even after all my steps have been completed before the start of the table row? Thanks in advance.


UPDATE:

@Mahmoud, using your suggestion, I called the following: enter image description here

+3
source share
1 answer

DBAPI, , , SELECT.

import MySQLdb
db = MySQLdb.connect(host="host", user="username", passwd="your-pass", db="the-db-name")

, :

cursor = db.cursor()
max_age = 42
cursor.execute("""SELECT name FROM employees WHERE age < %s""", (max_age,))
print cursor.fetchone()

, , , ORM, SQLAlchemy. , .

+2

All Articles