To test if the installation was successful, or if you already have "MySQL Connector" installed, create a Python page with the following content:
import mysql.connector
-------------
Create Connection
Start by creating a connection to the database.
Use the username and password from your MySQL database:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="ram1234"
)
print(mydb)
--------------------------
Microsoft Windows [Version 10.0.19042.1110]
(c) Microsoft Corporation. All rights reserved.
C:\Users\VLR Training>python --version
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
WARNING: You are using pip version 21.1.3; however, version 21.2.2 is available.
You should consider upgrading via the 'C:\Users\VLR Training\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.
C:\Users\VLR Training>cd desktop
C:\Users\VLR Training\Desktop>pyton ram.py
'pyton' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\VLR Training\Desktop>python ram.py
C:\Users\VLR Training\Desktop>python ram.py
File "C:\Users\VLR Training\Desktop\ram.py", line 10
^
SyntaxError: unexpected EOF while parsing
C:\Users\VLR Training\Desktop>python ram.py
<mysql.connector.connection.MySQLConnection object at 0x000001C935AF1BE0>
C:\Users\VLR Training\Desktop>
No comments:
Post a Comment
Note: only a member of this blog may post a comment.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.