Changing User Passwords in the Carbon Database
The password of the system administrator is stored in the primary user store. If, for any reason, you need to change the admin password, the chpasswd.sh
 (for linux) or chpasswd.bat
 (for windows) script should be executed in the <PRODUCT_HOME>/bin/Â
directory as explained below.
Before executing this script, the Carbon instance should be shut down.
To run the chpasswd
 script:
- Open a command prompt and go to theÂ
<PRODUCT_HOME>/bin
 folder on the machine that hosts the Carbon server. - When you run the script, you need to provide the following information:
- The Carbon database URL:Â By default, WSO2 Carbon is shipped with H2 database so the default URL is:
jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE
. This URL may change if a different database was specified during the installation. Then the URL will be in the form ofjdbc:h2:repository/database/WSO2CARBON_DB
. - The Database driver class: For the default H2 database, the driver will be automatically picked up by the system. If a different database is used, the driver class needs to be specified.
- The database's username and password: Again for the default H2 database, the default username and password will be used by the system. However, if a different username/password is used, you are required to reset the admin password.
- The username and new password of the user whose password is to be changed: If you do not provide these as command line arguments, you will be prompted for it during execution.
The command line options available for chpasswd is as follows:
Command Line Option
Description
Mandatory?
--db-url
The database URL
Yes
--db-driver
The database driver class
No
--db-username
The username for the database
No
--db-password
The password for the database
No
--username
The username of the user whose password is to be changed.
If this is not given, you will be prompted for this field later.No
--new-password
The new password of the user whose password is to be changed.
If this is not given, you will be prompted for this field later.No
For example,
On Linux:Â
chpasswd.sh --db-url "jdbc:h2:repository/database/WSO2CARBON_DB"Â
On Windows:Âchpasswd.bat --db-url "jdbc:h2:repsitory/database/WSO2CARBON_DB"
The following message is displayed if the password is updated successfully:
Password of user [username] updated successfully
If the database path includes directory names with spaces, the whole URL needs to be included within quotations.
- The Carbon database URL:Â By default, WSO2 Carbon is shipped with H2 database so the default URL is: