0% found this document useful (0 votes)
5 views1 page

MySQL Setup and Python Integration Guide

The document outlines a step-by-step process for setting up a MySQL database on Ubuntu, including installing the MySQL connector, updating the root user authentication method, creating a database and table, and executing a Python script to insert data into the table. It provides specific commands to be run in the command prompt and details the content of the Python script. The author is Dr. Sharmila K. Wagh from MES College of Engineering, Pune.

Uploaded by

chamansharma6969
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

MySQL Setup and Python Integration Guide

The document outlines a step-by-step process for setting up a MySQL database on Ubuntu, including installing the MySQL connector, updating the root user authentication method, creating a database and table, and executing a Python script to insert data into the table. It provides specific commands to be run in the command prompt and details the content of the Python script. The author is Dr. Sharmila K. Wagh from MES College of Engineering, Pune.

Uploaded by

chamansharma6969
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Ubuntu open command prompt then

1. pip install mysql-connector

>sudo mysql -u root -p

>USE mysql;

>UPDATE user SET plugin='mysql_native_password' WHERE User='root';

>FLUSH PRIVILEGES;

>exit;

>service mysql restart

3. then again open mysql

> create database db3;

> use db3;

> create table stud1(name varchar(10), rno int);

> exit;

[Link] root prompt execute following python file ( which is saved in home
directory)

file name is [Link]

> python3 [Link]

5. then open mysql

> use db3

> select * from stud1;

************
[Link]
**
import [Link]
mydb = [Link](
host="localhost",
user=" root",
# password="",
database="db3"
)
mycursor = [Link]()
sql = "INSERT INTO stud1 (name, rno) VALUES ('Ram', 22)"
[Link](sql)
[Link]()
print([Link], "record inserted.")

[Link] [Link] MES College of Engg,Pune

You might also like