Create a connection to the database. It is strongly recommended that you only use keyword parameters. Consult the MySQL C API documentation for more information. :param str host: host to connect :param str user: user to connect as :para
(self, *args, **kwargs)
| 54 | default_cursor = cursors.Cursor |
| 55 | |
| 56 | def __init__(self, *args, **kwargs): |
| 57 | """ |
| 58 | Create a connection to the database. It is strongly recommended |
| 59 | that you only use keyword parameters. Consult the MySQL C API |
| 60 | documentation for more information. |
| 61 | |
| 62 | :param str host: host to connect |
| 63 | :param str user: user to connect as |
| 64 | :param str password: password to use |
| 65 | :param str passwd: alias of password (deprecated) |
| 66 | :param str database: database to use |
| 67 | :param str db: alias of database (deprecated) |
| 68 | :param int port: TCP/IP port to connect to |
| 69 | :param str unix_socket: location of unix_socket to use |
| 70 | :param dict conv: conversion dictionary, see MySQLdb.converters |
| 71 | :param int connect_timeout: |
| 72 | number of seconds to wait before the connection attempt fails. |
| 73 | |
| 74 | :param bool compress: if set, compression is enabled |
| 75 | :param str named_pipe: if set, a named pipe is used to connect (Windows only) |
| 76 | :param str init_command: |
| 77 | command which is run once the connection is created |
| 78 | |
| 79 | :param str read_default_file: |
| 80 | file from which default client values are read |
| 81 | |
| 82 | :param str read_default_group: |
| 83 | configuration group to use from the default file |
| 84 | |
| 85 | :param type cursorclass: |
| 86 | class object, used to create cursors (keyword only) |
| 87 | |
| 88 | :param bool use_unicode: |
| 89 | If True, text-like columns are returned as unicode objects |
| 90 | using the connection's character set. Otherwise, text-like |
| 91 | columns are returned as bytes. Unicode objects will always |
| 92 | be encoded to the connection's character set regardless of |
| 93 | this setting. |
| 94 | Default to True. |
| 95 | |
| 96 | :param str charset: |
| 97 | If supplied, the connection character set will be changed |
| 98 | to this character set. |
| 99 | |
| 100 | :param str collation: |
| 101 | If ``charset`` and ``collation`` are both supplied, the |
| 102 | character set and collation for the current connection |
| 103 | will be set. |
| 104 | |
| 105 | If omitted, empty string, or None, the default collation |
| 106 | for the ``charset`` is implied. |
| 107 | |
| 108 | :param str auth_plugin: |
| 109 | If supplied, the connection default authentication plugin will be |
| 110 | changed to this value. Example values: |
| 111 | `mysql_native_password` or `caching_sha2_password` |
| 112 | |
| 113 | :param str sql_mode: |
nothing calls this directly
no test coverage detected