创建库并指定编码
- create database if not exists my_db default character set utf8 collate utf8_general_ci;
- create database if not exists my_db default character set utf8mb4 collate utf8mb4_unicode_ci;
修改字段长度
- alter table mgr_index_storage modify column query varchar(2000);
修改字段名称
- alter table mgr_user_search CHANGE utime mtime DATETIME;
In查询的自定义排序
- select * from log_process_detail where id in(3,2,4,1) ORDER BY FIND_IN_SET( id, '3,2,4,1')
MySQL字符串包含
- SELECT * FROM mgr_fact_index WHERE mdwql like "%channel_user_reg%";
- SELECT * FROM mgr_fact_index WHERE find_in_set('channel_user_reg', mdwql);
- SELECT * FROM mgr_fact_index WHERE locate('channel_user_reg',mdwql)=0
MySQL导出database
- sudo mysqldump -h 127.0.0.1 -u* -p* eventapi > eventapi.sql
添加字段
- alter table mgr_fact_index add is_pub TINYINT NOT Null DEFAULT 0;
- alter table mgr_template_mql_template add is_multi_date tinyint(4) NOT NULL DEFAULT 0, add date_scope_start varchar(8) DEFAULT NULL;
网友评论