简体   繁体   中英

How do I change the password of a sql user that has a blank name?

My H2 database's root user's name is completely blank so when I try to use the password change command on it, but it doesn't work. I receive this error every time I try:

Syntax error in SQL statement "ALTER USER   SET PASSWORD[*] 'newpassword'"; expected "SET, RENAME, ADMIN"; SQL statement:
ALTER USER   SET PASSWORD 'newpassword' [42001-195] 42001/42001

I think it may be possible to alter it using the user's ID (13) but I have no idea how to go about that. I've also tried putting '' as the user which didn't work.

If the user name is truly blank the following should work:

ALTER USER "" SET PASSWORD 'newPass';

Similarly to change it to a more normal name:

ALTER USER "" RENAME TO WHATEVER;

It's also possible that somebody decided to play an even bigger trick on you and name the user
" " (2 spaces) or some other name that consists of whitespaces, you can check it by copying the name to an editor that can show whitespaces. If this is the case you need to put the name exactly as is in the double quotes.

尝试这个

ALTER USER user_ID SET PASSWORD 'rioyxlgt' 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM