.\" Automatically generated by Pandoc 3.5 .\" .TH "mysql_change_user" "3" "" "Version 3.4" "MariaDB Connector/C" .SS Name mysql_change_user \- changes user and default database .SS Synopsis .IP .EX #include \f[B]\f[R] my_bool mysql_change_user(MYSQL * mysql, const char * user, const char * passwd, const char * db); .EE .SS Description Changes the user and default database of the current connection. .PP In order to successfully change users a valid username and password parameters 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. .SS Parameters .IP \[bu] 2 \f[CR]mysql\f[R] is a connection identifier, which was previously allocated by \f[B]mysql_init(3)\f[R] and connected by \f[B]mysql_real_connect(3)\f[R]. .IP \[bu] 2 \f[CR]user\f[R] \- the user name for server authentication .IP \[bu] 2 \f[CR]passwd\f[R] \- the password for server authentication .IP \[bu] 2 \f[CR]db\f[R] \- the default database. If desired, the NULL value may be passed resulting in only changing the user and not selecting a database. To select a database in this case use the \f[B]mysql_select_db(3)\f[R] function. .SS Notes .IP \[bu] 2 mysql_change_user will always cause the current database connection to behave as if was a completely new database connection, regardless of if the operation was completed successfully. This reset includes performing a rollback on any active transactions, closing all temporary tables, and unlocking all locked tables. .IP \[bu] 2 To prevent denial of service and brute\-force attacks the server will block the connection if \f[CR]mysql_change_user()\f[R] failed three times in a row .SS Return value Returns zero on success, nonzero if an error occurred. .SS See also .IP \[bu] 2 \f[B]mysql_real_connect(3)\f[R] .IP \[bu] 2 \f[B]mysql_select_db(3)\f[R]