Setup password for H2

流过昼夜 提交于 2019-12-05 16:04:11

问题


How to set up my own password for accessing the h2 while working in embedded mode?

(if anyone confused - talking about the root password for accessing the database)

In Eclipse it seems that password assignment occurs at the moment of db connection creation which in turn launches the process of schema creation, where we provide username and password.

Even if this is true how to change existing password after set up? I've searched in information schema - found `users', there is no password column though.

The process seems to be really weird, what am I missing. In PostgreSQL it is a way easier.

So the questions are:

  1. The passwords are assigned upon new schema creation?

  2. How to change the password for current user?

I suspect it is done via the query, I believe it will have specific syntax, if that is the case I would appreciate sample query too, as I am not yet famillar with this SQL implementation.


回答1:


Oh I guess life is not that bad :-).

Found on:

http://www.h2database.com/html/grammar.html#alter_user_set_password

To change it we obviously have to be able to connect to database(know username and password), as I said these are the ones we use during connection set up.

Then create simillar sql snippet ALTER USER admin SET PASSWORD 'superPw';

I personally believe these high level operations have to be allowed to be done in wizards. Hope this helps.



来源:https://stackoverflow.com/questions/10808525/setup-password-for-h2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!