Home > Database > Mysql Tutorial > body text

python连接MySQL connect函数的参数说明_MySQL

WBOY
Release: 2016-06-01 13:12:28
Original
3676 people have browsed it

python

python连接MySQL connect函数的参数说明

python连接MySQL connect函数的参数说明

cxn=MySQLdb.Connect(host='localhost',user='root',passwd='',db='samp_db',port=3306)
Copy after login
connect函数的参数

1、host参数表示的是数据库所在地址,默认值是localhost,也就是说本机运行这个参数可以不指定

    2、user、passwd 数据库的用户名和密码,必须存在

    3、db 选择你要操作的数据库名,这个可以稍后指定,非必须

    4、port 端口号,默认值3306

    5、charset 用来指定字符集(默认utf8)



编程无忧网整理发布

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!