mysql

常用sql

查询数据库每个表的行数

select table_name,table_rows from information_schema.tables where TABLE_SCHEMA = 'test' order by table_rows desc; 

mysql时间转换

select FROM_UNIXTIME(1156219870); //时间戳转为日期
select UNIX_TIMESTAMP('2006-11-04 12:23:00');  //日期转为时间戳
//格式化shij
SELECT FROM_UNIXTIME(last_login, '%Y-%m-%d %H:%i:%s') FROM `test`;

授予权限

grant all on ydd.* to www@'%' ;
flush privileges;

#创建用户

create user 'www'@'%' identified by 'iamsuperboy';