Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Finishing System Setup With Connector

00:00 Having installed the MySQL server, there is one more component that you need to install in order to complete the MySQL system setup. It’s a Python MySQL connector highlighted in orange color on this slide.

00:15 Generally speaking, it doesn’t have to be Python. It depends on the language of programming that you used to build an application. Do you recall the main function of the client layer?

00:26 It authenticates a client through the use of client credentials and enables interactions with the MySQL system. In this lesson, you’ll be setting up the Python MySQL connector.

00:41 Let’s run a shell on your operating system. Depending on the operating system you use, it can be Windows PowerShell, BASH, or ZSH that I’m running. Let’s create a project folder called MySQLproject,

00:57 and let’s point to this newly created folder.

01:01 Next, you will have to create an isolated virtual environment. It’s a common practice, as it allows you to separate packages for this project into its own folder.

01:12 Type in python3 -m venv utils. Here, utils is the name of the virtual environment. Indeed, it has been created within the MySQLproject folder.

01:29 Next, activate your newly created virtual environment.

01:34 If you are a Windows user, you run the command .utilsScripts activate.

01:47 For other operating systems, run source utils /bin/activate. Now you see the change in your shell prompt and you’re ready to install MySQL connector to utils virtual environment. Run pip3 install mysql-connector- python. To test if the installation was successful, open your Python development environment and type import mysql .connector.

02:25 If this command runs without errors, then the MySQL connector is installed and ready to use. If you encounter any errors, then make sure you are in the correct virtual environment.

02:39 Great news! You have fully completed the MySQL system setup.

Become a Member to join the conversation.