WAMP-PHPMYADMIN USING IN PYTHON METHOD

 

Install MySQL Driver:


Move to ur Python Scripts location



Microsoft Windows [Version 10.0.18363.1256]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\RCF>cd..

C:\Users>cd..

C:\>cd Python3.9.1

C:\Python3.9.1>cd Scripts

C:\Python3.9.1\Scripts>python -m pip install mysql-connector-python
Collecting mysql-connector-python
  Downloading mysql_connector_python-8.0.22-py2.py3-none-any.whl (374 kB)
     |████████████████████████████████| 374 kB 6.4 MB/s
Collecting protobuf>=3.0.0
  Downloading protobuf-3.14.0-py2.py3-none-any.whl (173 kB)
     |████████████████████████████████| 173 kB 6.4 MB/s
Collecting six>=1.9
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: six, protobuf, mysql-connector-python
Successfully installed mysql-connector-python-8.0.22 protobuf-3.14.0 six-1.15.0
WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Python3.9.1\python.exe -m pip install --upgrade pip' command.

C:\Python3.9.1\Scripts>


Download and install "MySQL Connector":

C:\Users\Your Name\AppData\Local\Programs\Python\Python36-32\Scripts>python -m pip install mysql-connector-python

Test MySQL Connector

open file location like i did as :

http://localhost:81/python/configcheck.py

#!C:/Python3.9.1/python.exe

print("content-type: text/html\n\n" )


import mysql.connector

mydb = mysql.connector.connect(
  host="localhost",
  user="root",
  password="",
  database="rcf_entry_system"
)

mycursor = mydb.cursor()



mycursor.execute("SHOW TABLES")

for x in mycursor:
  print(x)

Comments

Popular posts from this blog

Python to automate What's App messages

Building RESTful APIs with Flask in PyCharm

Redirecting to another page with button click in Python-flask