Mysql操作——DML-2.更新操作

更新操作

\color{red}{update 表名 set 列名1=列值1,列名2=列值2......where 列名=值;}

  • 把所有学生的分数改为90
mysql> update students set score=90;
  • 把姓名为zs的学生分数改为60
mysql> update students set score=60 where name='zs';
  • 把姓名为李四的年龄改为20,分数改为70
mysql> update students set age=30,score=70 where name='ls';
  • 把wc的年龄在原来的基础上加1岁
mysql> update students set age=age+1 where name='wc';
  • \color{red}{修改数据库密码方式1}
mysql> update user set authentication_string=password('root') where user='root' and Host = 'localhost';
mysql> flush privileges; # 刷新Mysql的系统权限相关表

  • \color{red}{修改数据库密码方式2}

设置好环境标量后,在cmd终端输入命令修改密码

C:\Users\Denve>mysqladmin -u root -p password root;
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容