19. mysql 删除主键:
alter table tb drop primary key;
添加联合主键:
alter table tb add primary key(date, platform);
添加列:
alter table tb add platform tinyint default 0;
添加列的默认值
alter table tb alter column platform set default 1;
列重命名
alter table test change name name_new varchar(20);
修改长度
alter table user modify column user_stat1 varchar(2048);
36. mysql的binlog安全删除
purge binlog to 'mysql-bin.001151'; 删除binlog, purge会更新mysql-bin.index中的条目, mysql-bin.index的作用是加快查找binlog文件的速度
37. 修改mysql表的默认值
alter table表名alter column字段名drop default; (若本身存在默认值,则先删除)
alter table 表名 alter column 字段名 set default 默认值;(若本身不存在则可以直接设定)
alter table pms_pay add
53. Json, value 转 string
Json::FastWriter write;
user.user_stat = write.write(user_stat);
54. perl 用 DBI, 做 update, delete, insert, alter 处理
my $sql = “alter table user add index socre_index(score)”;
$dbh->do( $sql);
if ( $dbh->err() )
{
die “$DBI::errstr\n”;
}
$dbh->commit();
55. Mysql 增加索引
alter table score add index socre_index(score);
alter table score drop index socre_index;
67. mysql 修改root 密码
方案一
mysql> use mysql;
mysql> update user set password=password('root') where user='root' and host='localhost';
update user set password=password('tgame') and host='%' where user='tgame';
update user set host='%' where user='tgame';
update user set host='10.145.11.190' where user='tgame';
mysql> update user set password=password('tgame') where user='tgame' and host='%';
update user set host='127.0.0.1' and password=password('root') where user='root';
flush privileges;
方案二:
grant all privileges on *.* to tgame@l0.145.11.190 identified by "tgame";
grant all privileges on *.* to fgame@127.0.0.1 identified by "root";
grant all privileges on *.* to tgame@localhost identified by "tgamedb";
grant all privileges on *.* to tgame@localhost identified by "tgamedb";
grant all privileges on *.* to tgame@localhost identified by "";
grant all privileges on *.* to root@127.0.0.1 identified by "root";
grant all privileges on *.* to ddz@127.0.0.1 identified by "password";
grant all privileges on *.* to root@localhost;
grant all privileges on *.* to root@10.10.2.92;
grant all privileges on *.* to root@10.144.94.39 ;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
grant all on *.* to root@127.0.0.1;
grant select on *.* to root@127.0.0.1;
flush privileges;
132. mysql 自增字段设置初始值
alter table pms_pay auto_increment = 101000;
133. mysql创建用户:
CREATE USER 'roott'@'localhost' IDENTIFIED BY 'Password!#DD';
grant all privileges on *.* to roott@localhost identified by "Password";
flush privileges;
134. redis 配置需要研究下
135. php laravel 启动
php artisan serve
136. mysql update
update pms_users set username='admin' , password='21232f297a57a5a743894a0e4a801fc3' where userid = '1461312703628858832';