首页 > 技术文章 > mysql奇葩之旅

airduce 2018-03-16 10:53 原文

一、

  update
srba_person_critical_business 
set period_to = DATE_ADD(period_to,INTERVAL -30 DAY),remark = CONCAT(remark,';原本to是',period_to,'小杨新改为',DATE_ADD(period_to,INTERVAL -30 DAY))
 where DATEDIFF(period_to,period_from)=395 and YEAR(insert_time)='2017';

执行这条update,发现remark字段中取到的period_to的值竟是第一个set之后的值。

 1、修改密码:update user set password = password("123456");

2、赋值权限 :grant all privileges on *.* to 'root'@'%'  with grant option;

3、撤销权限:revoke delete on *.*  from 'root'@'%'.

更多详情参考

https://www.cnblogs.com/Richardzhu/p/3318595.html

 4、忘记密码的解决方法:

停掉服务

cd 到mysql/bin/

./mysqld_safe --skip-grant-tables &

mysql

修改密码

退出,杀掉所有的mysql。重启。

推荐阅读