Parameter description for connecting python to the MySQLconnect function _ MySQL

Source: Internet
Author: User
Tags mysql connect
Python parameter description for connecting to the MySQLconnect function

Parameters for connecting python to the MySQL connect function

Parameters for connecting python to the MySQL connect function

Cxn = MySQLdb. Connect (host = 'localhost', user = 'root', passwd = '', db = 'samp _ db', port = 3306)
Connect function parameters

1. the host parameter indicates the address of the database. the default value is localhost. that is to say, the local machine can run this parameter without specifying

2. the user name and password of the user and passwd database must exist.

3. select the database name you want to operate on the database. this can be specified later, not required

4. port number. the default value is 3306.

5. charset is used to specify the character set (utf8 by default)



Programming render network finishing release

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.