#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'Mysql 连接数据库'

__author__ = 'garyhu'

import mysql.connector;

# 数据库连接
conn = mysql.connector.connect(user='root',password='****',database='websites');
s = conn.cursor();

s.execute('select * from users where id = %s',(7,))

value = s.fetchall();

print(value);
s.close();


#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'Mysql 连接数据库'

__author__ = 'garyhu'

import mysql.connector;

# 数据库连接
conn = mysql.connector.connect(user='root',password='****',database='websites');
s = conn.cursor();

s.execute('select * from users where id = %s',(7,))

value = s.fetchall();

print(value);
s.close();


#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 数据库连接