Skip to main content

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-pythoneasy_install mysql-python (mix os)

pip install mysql-pythonpip install mysql-python (mix os/ python 2)

pip install mysqlclientpip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldbapt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install cleancd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-pythonyum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recyclecreate_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

deleted 2 characters in body
Source Link
Jasir
  • 21
  • 2

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;") conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

Step 1 If you want to use MySQLDB you need to use one of the following commands. Which one depends on what OS and software you have and use.

easy_install mysql-python (mix os)

pip install mysql-python (mix os/ python 2)

pip install mysqlclient (mix os/ python 3)

apt-get install python-mysqldb (Linux Ubuntu, ...)

cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)

yum install MySQL-python (Linux Fedora, CentOS ...)

For Windows, see this answer: Install mysql-python (Windows)

Step 2:

  1. Create Engine

engine = create_engine('mysql+mysqldb://...', pool_recycle=3600)

use the create_engine.pool_recycle option which ensures that a connection will be discarded and replaced with a new one if it has been present in the pool for a fixed number of seconds:

  1. Create Connection object

conn = engine.connect()

  1. Execute SQL queries

conn.execute("SELECT * From table;")

Source Link
Jasir
  • 21
  • 2
Loading