简体   繁体   English

MySQL更新用户密码

[英]Mysql updating user password

I am trying update password for database using mybatis: 我正在尝试使用mybatis更新数据库密码:

update person 
   set name = #{name}, 
       address = #{address}, 
       phoneNumber = #{phoneNumber},
       balance = #{balance}, 
       password = #{password}, 
       id = #{new_id} 
 where id = #{id}

However, got following exception: 但是,出现以下异常:

org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'id' cannot be null
### The error may involve com.lsp.mybatis.PersonMapper.update-Inline
### The error occurred while setting parameters
### SQL: update person set name = ?, address = ?, phoneNumber = ?             ,balance = ?, password = ?, id = ? where id = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'id' cannot be null

I have specified the user id I want to update. 我已经指定了要更新的用户ID。 Why is it saying "id cannot be null"? 为什么说“ id不能为空”?

Can someone tell me what I did do wrong? 有人可以告诉我我做错了什么吗?

Remove in the query: id = #{new_id} . 在查询中删除: id = #{new_id}

So, the query will be: 因此,查询将是:

update person 
   set name = #{name}, 
       address = #{address}, 
       phoneNumber = #{phoneNumber},
       balance = #{balance}, 
       password = #{password}
 where id = #{id}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL:用户拒绝访问...使用密码:是 - MySQL : Access denied for user … using password : YES Java-没有密码的用户的mysql访问被拒绝错误 - Java - mysql access denied error for user with no password 使用 user.reauthenticate 更新 Firebase 身份验证密码 - Updating Firebase Authentication password using user.reauthenticate 用户'user'@'localhost'的Mysql Access被拒绝(使用密码:是)“ openshift” - Mysql Access denied for user 'user'@'localhost' (using password: yes) “openshift” 无法从mysql中检索用户身份(用户名和密码)进行登录 - Unable to retrieve the user identity (userName and password)from mysql to login 用户'root'@'localhost'的mysql访问被拒绝(使用密码:否) - mysql Access denied for user 'root'@'localhost' (using password: NO) MySQL同时插入用户名和密码,但在不同的表中 - MySQL Insert User and Password at the same time, but in different tables Spring Security配置无法从MySQL验证用户/密码 - Spring Security configuration not validating user/password from mysql Mariadb连接客户端:在mysql 8.0上拒绝用户访问(使用密码:NO) - Mariadb connection client: Access denied for user (using password: NO) on mysql 8.0 如何从MySql PhpMyadmin本地主机访问用户电子邮件和密码 - How to Access User Email and Password from MySql PhpMyadmin Local host
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM