Changes the user and default database of the current connection. A valid username and password pair must be provided and that user must have sufficient permissions to access the desired database. If for any reason authorization fails, the current user authentication will remain.

See also: MariaDB Connector/Python 1.0


import mariadb

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

conn.change_user('joe', 'secret2', 'test_table')