Reputation: 433
i can’t change a password for H2 db. I tried to do it with command:
chpasswd.sh --db-url "jdbc:h2:repository/database/WSO2CARBON_DB" --db-driver org.h2.Driver --db-username ... --db-password ... --username ... --new-password ...
When i start the command, it ends successfully. But password are not changed. IS doesn't start with a new password, it starts with an old password. How to change a password for H2 db?
Upvotes: 2
Views: 6153
Reputation: 422
WSO2 product provided "chpasswd.sh" script is to change the admin password of the product and it has nothing to do with h2 database password.
If you are trying to change the H2 database password you will have to login to h2 console and update the db user password. Following are the steps.
You can download the h2 console form[1]. After that unzip it and go to h2/bin folder. Then start h2 console with below command.
sh h2.sh
Now you can access the h2 console in the browser (http://localhost:8082) and access the db with db path and current credentials. Then run the below SQL to update the DB password.
ALTER USER wso2carbon SET PASSWORD 'NEW_PASSWORD'
After this change the WSO2 product will not start due to the db password update. You will have to update the db password in "repository/conf/datasources/master-datasources.xml" file.
Also, it is important to mention that H2 is not recommended for WSO2 products in production use.
[1] http://www.h2database.com/h2-2017-06-10.zip
Upvotes: 3
Reputation: 1269
I assume you are following this document. Please note that this is only used when you don't know the admin password and need to reset it. If you know the current password, you may just follow this.
By default, WSO2 IS comes with a LDAP userstore. You can check the active userstore by checking "UserStoreManager" at [IS_HOME]/repository/conf/user-mgt.xml. More info here.
If it is JDBC, you have to find the relevant DB from the [IS_HOME]/repository/conf/datasources/master-datasources.xml by checking the dataSource name in user-mgt.xml and follow the steps in this guide.
If it is LDAP, you may have to change the password by connecting to that ldap via a tool like Apache Directory Studio.
Upvotes: 0
Reputation: 41
You can use one command from the followings to change the admin user password of the H2 database.
sh chpasswd.sh --db-url "jdbc:h2:repository/database/WSO2CARBON_DB" --db-driver "org.h2.Driver" --db-username "wso2carbon" --db-password "wso2carbon" --username "admin" --new-password "admin123"
sh chpasswd.sh --db-url "jdbc:h2:repository/database/WSO2CARBON_DB" --username "admin" --new-password "admin123"
If you still face the same issue, mention the WSO2 product and the product version which you are trying to change the admin password.
Upvotes: 0