MySQL Connector/Python Developer Guide

10.2.46 MySQLConnection.server_port Property

This read-only property returns the TCP/IP port used for connecting to the MySQL server.

Returns an integer.