常用命令
来源:互联网 发布:php调用类中的方法 编辑:程序博客网 时间:2024/06/06 00:39
1、创建用户并分配权限
GRANT ALL PRIVILEGES ON *.* TO 'zhangyajun'@'localhost' IDENTIFIED BY '810524' WITH GRANT OPTION;
2、修改密码
update mysql.user set password=PASSWORD('8170') where user='root';
FLUSH PRIVILEGES;
3、mysql授权查看
select user from mysql.db where db= "len" 查看len数据库已经授权的用户
4、登录
mysql -S /opt/DATA/my3306/my3306.sock -u tpcdevp2 -p****
5、 mysql語句命令行直接執行
mysql -u zhangyajun -p810524 -h 10.10.92.121 -P 3306 -D newmoon -e "load data local infile 'e:/test.txt' into table newmoon.category fields terminated by ' ' lines terminated by '/r/n';"
6、mysql常用日期操作
查询当天的记录
select * from hb_article_view where TO_DAYS(hb_AddTime) = TO_DAYS(NOW())
查询当前这周的数据
SELECT name,submittime FROM enterprise WHERE YEARWEEK(date_format(submittime,'%Y-%m-%d')) = YEARWEEK(now());
查询上周的数据
SELECT name,submittime FROM enterprise WHERE YEARWEEK(date_format(submittime,'%Y-%m-%d')) = YEARWEEK(now())-1;
查询当前月份的数据
select name,submittime from enterprise where date_format(submittime,'%Y-%m')=date_format(now(),'%Y-%m')
查询距离当前现在6个月的数据
select name,submittime from enterprise where submittime between date_sub(now(),interval 6 month) and now();
查询上个月的数据
select name,submittime from enterprise where date_format(submittime,'%Y-%m')=date_format(DATE_SUB(curdate(), INTERVAL 1 MONTH),'%Y-%m')
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- 常用命令
- nutch+struts2整合二次开发代码
- WinCE上BINFS实现详解
- Hibernate JPA 配置
- Spring 2.5 JPA hibernate 使用方法整理(一)
- 一周实习体会
- 常用命令
- WPF/Silverlight 控件的基本组成
- http://www.cnblogs.com/dubingsky/archive/2009/07/16/1524742.html
- 关于sql server 代理(已禁用代理 xp)
- Spring + JPA + Hibernate + Tomcat + EHCache
- oracle库表修改
- 前台JS(Jquery)调用后台方法 无刷新级联菜单示例
- Refactoring: write code that humans can understand
- How many pieces of land?