Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use mysql-connector connection to use MySQL

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to use mysql-connector connection to use MySQL", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use mysql-connector connection to use MySQL" article.

Mysql-connector is the official drive provided by MySQL.

We can use the pip command to install mysql-connector:

Python-m pip install mysql-connector

Test whether mysql-connector is installed successfully using the following code:

Demo_mysql_test.py:

Import mysql.connector

Execute the above code, if there is no error, it indicates that the installation is successful.

Note: if your MySQL is version 8.0, the password plug-in verification method has changed. The previous version is mysql_native_password,8.0 and the version is caching_sha2_password, so you need to make some changes:

Modify the my.ini configuration first:

[mysqld] default_authentication_plugin=mysql_native_password

Then change the password by executing the following command under mysql:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY' new password; the above is about "how to use mysql-connector connection to use MySQL" this article, I believe we all have a certain understanding, I hope the content shared by the editor will be helpful to you, if you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report