server_port

Overview

The port number that was used to make the connection to the database. (read-only)

See also: MariaDB Connector/Python 1.1 and in 1.0

DETAILS

The database server TCP/IP port specified when connecting. If a unix_socket was used, the value will be 0.

EXAMPLES

import mariadb

conn = mariadb.connect(
    host = 'localhost',
    user = 'root',
    password = 'secret',
    port = 3306,
    )

print(conn.server_port) # Prints: 3306

CHANGE HISTORY

Release Series

History

1.1

  • Present starting in MariaDB Connector/Python 1.1.0rc1.

1.0

  • Present starting in MariaDB Connector/Python 1.0.0.