1mysql_change_user(3)          MariaDB Connector/C         mysql_change_user(3)
2
3
4
5   Name
6       mysql_change_user - changes user and default database
7
8   Synopsis
9              #include <mysql.h>
10
11              my_bool mysql_change_user(MYSQL * mysql,
12                                        const char * user,
13                                        const char * passwd,
14                                        const char * db);
15
16   Description
17       Changes the user and default database of the current connection.
18
19       In order to successfully change users a valid username and password pa‐
20       rameters must be provided and that user must  have  sufficient  permis‐
21       sions  to access the desired database.  If for any reason authorization
22       fails, the current user authentication will remain.
23
24   Parameters
25       • mysql is a connection identifier, which was previously  allocated  by
26         mysql_init(3) and connected by mysql_real_connect(3).
27
28       • user - the user name for server authentication
29
30       • passwd - the password for server authentication
31
32       • db  - the default database.  If desired, the NULL value may be passed
33         resulting in only changing the user and not selecting a database.  To
34         select a database in this case use the mysql_select_db(3) function.
35
36   Notes
37       • mysql_change_user  will  always cause the current database connection
38         to behave as if was a completely new database connection,  regardless
39         of  if the operation was completed successfully.  This reset includes
40         performing a rollback on any active transactions, closing all  tempo‐
41         rary tables, and unlocking all locked tables.
42
43       • To  prevent denial of service and brute-force attacks the server will
44         block the connection if mysql_change_user() failed three times  in  a
45         row
46
47   Return value
48       Returns zero on success, nonzero if an error occurred.
49
50   See also
51mysql_real_connect(3)
52
53mysql_select_db(3)
54
55
56
57Version 3.2.2                                             mysql_change_user(3)
Impressum