.\" Automatically generated by Pandoc 2.5 .\" .TH "mysql_change_user" "3" "" "Version 3.2.2" "MariaDB Connector/C" .hy .SS Name .PP mysql_change_user \- changes user and default database .SS Synopsis .IP .nf \f[C] #include my_bool mysql_change_user(MYSQL * mysql, const char * user, const char * passwd, const char * db); \f[R] .fi .SS Description .PP 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[C]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[C]user\f[R] \- the user name for server authentication .IP \[bu] 2 \f[C]passwd\f[R] \- the password for server authentication .IP \[bu] 2 \f[C]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[C]mysql_change_user()\f[R] failed three times in a row .SS Return value .PP 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]