mysql综合

分类:计算机 | 数据库 | MySQL | 安装 1808
更新:2020-12-19 19:47:57
编辑

修改mysql配置

linux下编辑配置文件my.cnf:

vi /etc/my.cnf

重启mysql

service mysql restart

linux中登录mysql

mysql -u root -p

查询mysql版本

select version();

查询数据更新时间在当前时间的前24小时内的数据

select * from tb_user where time >= date_sub(sysdate(),interval 1 day);

将表中某个值为null或者空串的字段全部更新为指定值

update tb_user set user_name='zhangsan' where ISNULL(user_name)=1 or LENGTH(trim(user_name))<1;

查询表中某个字段不为null和空值的数据

select * from tb_user t where ISNULL(t.user_name )=0 and LENGTH(trim(t.user_name ))>=1;