Search
 
SCRIPT & CODE EXAMPLE
 

SQL

python mysql github

Try this to connect to MySQL databases in Python (GitHub project link in source):

shell> pip install mysql-connector-python

import mysql.connector

# Connect to server
cnx = mysql.connector.connect(
    host="127.0.0.1",
    port=3306,
    user="mike",
    password="s3cre3t!")

# Get a cursor
cur = cnx.cursor()

# Execute a query
cur.execute("SELECT CURDATE()")

# Fetch one result
row = cur.fetchone()
print("Current date is: {0}".format(row[0]))

# Close connection
cnx.close()
Comment

PREVIOUS NEXT
Code Example
Sql :: Monthly Birthday SQL Query 
Sql :: BigQuery define array varriable 
Sql :: reorder primary key mysql 
Sql :: mysql make date from 2 column 
Sql :: update having mysql 
Sql :: concatenate text from multiple rows into a single text stringin SQL Server 
Sql :: how to do a function to return row type from a table in pl/sql 
Sql :: cast find duration in sql 
Sql :: opensuse stop MySQL 
Sql :: doing calculations in mysql 
Sql :: drop check command 
Sql :: Get the First and Last Word from a String or Sentence 
Sql :: sql parenthetical expression examples 
Sql :: sqlite ignore index 
Sql :: SOQL Child to parent 
Sql :: codeigniter MySQL - Issue with SELECT & GROUP BY 
Sql :: ora 00001 in oracle 
Sql :: what is union in sql 
Sql :: modificar tipo de dato sql server 
Sql :: mysql order by calculated column 
Sql :: select lowest values sql 
Sql :: data structures in sql 
Sql :: Resolved [java.sql.SQLException: ORA-29977: Unsupported column type for query registration in guaranteed mode ] 
Csharp :: c# get number of files in directory 
Csharp :: how to make c# open brower 
Csharp :: how to detect mouse click in c# 
Csharp :: ALWAYS MAximize window on start c# 
Csharp :: check connection c# 
Csharp :: unity set object scale 
Csharp :: c# list files in directory 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =