Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
30 views

Python, MySQL, and MySQL Connector Installations

Python installation

Uploaded by

Dayit Mitra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Python, MySQL, and MySQL Connector Installations

Python installation

Uploaded by

Dayit Mitra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Installing Python 3.

7 in your Computer
Steps to follow:
• Connect to the Internet
• In your browser open the site: https://www.python.org
• Click on the All releases option from the Downloads menu

• Scroll down the page and click on the Python 3.7.3 release
• In the next page, scroll down and click on the Windows x86 executable
installer link

• The Python installer executable file will get downloaded (you may have to
click on the Save button, if you have an older browser)

• Go to the Downloads folder and double click on the downloaded


python-3.7.3.exe installer file to install Python

• Click on the Start button to open the program list and open Python
Installing MySQL in your Computer
Can also view the following video from YouTube for the installation process:
https://www.youtube.com/watch?v=WuBcTJnIuzo
Steps to follow:
1. Connect to the Internet
2. Open your Browser
3. Open the Google site
4. In the Google Search Box type download mysql and press ENTER

5. Click on the MySQL Downloads – MySQL link to open the MySQL


Community Downloads page
Or
Instead of Step 3 and 4, you can type the following link in your browser
address box and press ENTER to open the following same page:
https://dev.mysql.com/downloads/
6. In the Community Downloads page, click on the MySQL Community
Server option link
7. In the next page that opens, click on the Go to Download Page link

8. In the next page that opens, click on the Download button for the option
Windows (x86, 32-bit), MSI Installer 405.2M version

9. In the next page that opens, click on the No thanks, just start my
download link near the bottom of the window
10. The mysql-installer-com…msi file will start to download

11. When the download is completed, click on the Open file link to start the
installation process.

12. The installation may ask you to wait while Windows configures MySQL
Installer Community version for your computer. If Windows asks whether
to allow this app to be installed, press on the Yes button to continue.

13. The installation will ask you to wait again while it Gathers required
information. Windows will again ask whether to allow this app to be
make changes to your PC. Press on the Yes button to continue.
14. It will continue with the installation and the License page will open. Click
the Accept checkbox, if you agree with the terms and conditions. Then
click on the Next button to continue

15. Next, the Setup Type selection window will open. Select the Developer
Default option and click on the Next button to continue
16. The Check Requirements window will open. It shows a list of components
that need to be installed before MySQL installation begins. The Product to
install, the Requirement for that, and the Status will be displayed.
If you click on Next, it will display a warning message. So, DO NOT click
the Next button before you install the missing components. To do that:
Get connected to the Internet and Click on the first entry under the
For Product column (like MySQL Server 8.0.22) and then click on the
Execute button to install the component. One-by-one click on the
remaining entries (except those marked as Manual under Status column)

17. Once the missing components are installed, the window will look like the
one shown below (with green ticks). Click on Next button to continue.
18. Next it will show a list of items to be installed in your computer. Click on
Execute button to continue the installation.

19. When the installation is over (this may take some time) green ticks will
appear against the components successfully installed. Click on Next
button to continue the installation.
20. Next the Product Configuration window will open. Click on Next button to
continue the product configuration process.

21. Next the Type and Networking window will open. Do Not change any
setting. Click on Next button to continue the installation process.
22. Next the Authentication Method window will open. Click on Next button
to continue the installation process with the default settings.

23. Next the Accounts and Roles window will open. Put the MySQL Root
Password and confirm it. Write down the password and DO REMEMBER
it. You will be required to type this password every time you login to
MySQL. This is called the root password. Click on Next button to continue
the installation process.
24. Next the Windows Service window will open. Do not change any settings.
Click on Next button to continue the installation process.

25. Next the Apply Configuration window will open. Click on the Execute
button to execute and apply the configuration changes.
26. Once the configurations are applied, it will show green ticks against each
of the configurations. Click on the Finish button to continue.

27. The Product Configuration window will open showing the list of products
to be configured. Click on the Next button to continue.
28. The MySQL Router Configuration window will open DO NOT change any
settings. Click on the Finish button to continue.

29. The Connect To Server window will open. Tick the check-box under the
Server column to select the MySQL Server 8.0.22 option. Type the User
name as root and under the Password box type the root password that
you had created earlier during the setup. You may click on the Check
button after this, to check the connection. If successful, the Status column
will show Connection succeeded. Click on the Next button to continue.
30. The Apply Configuration window will open. Click on the Execute button
to apply the configuration.

31. Once the configurations are applied, it will show green ticks against each
of the configurations. Click on the Finish button to continue.
32. The Product Configuration window will open again. Click on the Next
button to apply the configuration.

33. The Installation Complete window will open again. Click on the Finish
button to end the installation process.
34. The MySQL Command Window will open in case the installation is
successful. Type \quit in the command prompt or click on the cross x to
close the window

35. The MySQL Workbench will also get launched. This is a graphic interface
for MySQL. Click on the cross X to close the window
Opening and Working with MySQL
1. Click on Start and from the program listing click on the MySQL folder.
From the dropdown program listing, click on the MySQL 8.0 Command
Line Client option

2. The MySQL command window will open. Type the root password that
you created during the MySQL installation, to proceed any further.

3. The MySQL command prompt will open for you to type the commands.
prompt
4. In the command prompt type show databases; to view all existing default
databases in the MySQL installation (like sakila, sys, world etc.).

5. In the command prompt type create database shop; to create a new


database. Next type show databases; to view the name of the newly
created database
6. In the command prompt type use shop to open/enter the newly created
shop database

7. Next type the create table item command to create the item table (press
ENTER to move to the next line after writing each line of code):
Once the table is created, you can view the table in the database by
typing the show tables; command.

7. Next type the create table purchase command to create the purchase
table (press ENTER to move to the next line while creating the table):
Once the table is created, you can view both the tables in the database
by typing the show tables; command.
8. Next type the insert into item command to insert 5 rows in the item table
as shown below (be careful while writing the lines…):

9. Next type the insert into purchase command to insert 8 rows in the
purchase table as shown below (be careful while writing the lines…):

10. Next type two select command statements to view the data inserted into
the item and purchase tables as shown below:

11. Finally type quit in the SQL prompt to end the session.
Adding the Python path into the PATH variable in Windows
To establish a connection between a Python Program and MySQL, you must
include the Path of the Python installation into the PATH variable in Windows.
To do that:
1. Open the Windows Explorer window
2. Open the C drive (or the drive under which you have installed the
Python programming app)
3. Double click on Users folder
4. Within Users, Double click on UserName folder (where UserName
represents the name that you had used during the Windows
installation as the user. For my machine it is Joyrup, for example)
5. Within UserName, Double click on AppData folder
6. Within AppData, Double click on Local folder
7. Within Local, Double click on Programs folder
8. Within Programs, Double click on Python folder
9. Within Python, Double click on Python37-32 folder
10. Finally, the entire path of the Python installation is accessed

The path
for Python
installation

python.exe
file present
here
11. Click on the address box in the white space at the right of the displayed
path and copy the highlighted path using Ctrl+C keys. You may paste it
in Notepad, as this is required later on to set the PATH variable.

12. Right click on the Computer icon and click


on the Properties option from the
dropdown list

13. From the System window that


opens, click on the Advanced
system settings link

14. From the System Properties


dialogue box, click on the
Environment Variables… button
near the bottom of the dialogue
box
15. From the Environment Variables dialogue box, click on the Path entry
under the System variables section and then click on the Edit… button

16. From the Edit environment variable dialogue box, click on the New
button to add the Python path
17. In the next blank highlighted box paste the path that you had earlier
copied for the Python installation path. Click on OK and close all
previous dialogue boxes one by one.
Setting up the MySQL Connector for Python
To establish a connection between a Python program and MySQL, you should
next set up the MySQL Connector for Python. Before starting the setup, switch
on your data connection and connect to the Internet (otherwise the
installation process will not be able to download the required files to carry out
the installation)
To do that:
1. Open the path where Python is installed. You should go up to the
Scripts folder as shown below. Typically it will be like the one shown
below under the C: drive

Click here in the white


space in the address bar

2. The full path will be displayed as shown below:

3. From the keyboard press Ctrl+C keys to copy the path


4. Type Command in the Windows search box to open the command
prompt. From the program list click on the Command Prompt option

5. A window similar to the one shown below will open (the name will not
be Joyrup of course!)
6. Under the command prompt type cd\ and press ENTER to be in the
root drive for drive C:\> as shown below:

7. Type cd after the command prompt and paste the path for the Python
installation as copied in step-3 above. The command line will look
similar to the one shown below (the name will obviously not be Joyrup,
but your name or the name under which the Windows user was
created). Press ENTER to move into this path

8. The path will change as shown below:

9. After this type the following line in the command prompt:


pip install mysql-connector-python
as shown below, and press ENTER

10.The path will change as shown below:


11.The Python MySQL connector will get downloaded and installed in your
computer as shown below. After the installation is over, close the
command prompt

12.If You have correctly done all the installations, then the following code
will run and give you proper output (replace the ‘myPassword’ with the
password that you had created for your MySQL installation):

You might also like