易截截图软件、单文件、免安装、纯绿色、仅160KB

mysql命令大全

启动:net start mySql;
  进入:mysql -u root -p/mysql -h localhost -u root -p databaseName;
  列出数据库:show databases;
  选择数据库:use databaseName;
  列出表格:show tables;
  显示表格列的属性:show columns from tableName;
  建立数据库:source fileName.txt;
  匹配字符:可以用通配符_代表任何一个字符,%代表任何字符串;
  增加一个字段:alter table tabelName add column fieldName dateType;
  增加多个字段:alter table tabelName add column fieldName1 dateType,add columns fieldName2 dateType;
  多行命令输入:注意不能将单词断开;当插入或更改数据时,不能将字段的字符串展开到多行里,否则硬回车将被储存到数据中;
  增加一个管理员帐户:grant all on *.* to user@localhost identified by "password";
  每条语句输入完毕后要在末尾填加分号';',或者填加'\g'也可以;
  查询时间:select now();
  查询当前用户:select user();
  查询数据库版本:select version();
  查询当前使用的数据库:select database();
  
  1、删除student_course数据库中的students数据表:
  rm -f student_course/students.*
  
  2、备份数据库:(将数据库test备份)
  mysqldump -u root -p test>c:\test.txt
  备份表格:(备份test数据库下的mytable表格)
  mysqldump -u root -p test mytable>c:\test.txt
  将备份数据导入到数据库:(导回test数据库)
  mysql -u root -p test
  
  3、创建临时表:(建立临时表zengchao)
  create temporary table zengchao(name varchar(10));
  
  4、创建表是先判断表是否存在
  create table if not exists students(……);
  
  5、从已经有的表中复制表的结构
  create table table2 select * from table1 where 1<>1;
  
  6、复制表
  create table table2 select * from table1;
  
  7、对表重新命名
  alter table table1 rename as table2;
  
  8、修改列的类型
  alter table table1 modify id int unsigned;//修改列id的类型为int unsigned
  alter table table1 change id sid int unsigned;//修改列id的名字为sid,而且把属性修改为int unsigned


相关文档:

mySql数据库连接

Class.forName("com.mySQL.jdbc.Driver");
   String strUrl="jdbc:mysql://localhost:3306/stu?useUnicode=true&characterEncoding=GB2312";
   String strUser="nuey";
   String strPassword="password";
   Connection conn=DriverManager.getCon ......

MySQL使用触发程序

触发程序是与表有关的命名数据库对象,当表上出现特定事件时,将激活该对象。在某些触发程序的用法中,可用于检查插入到表中的值,或对更新涉及的值进行计算。
触发程序与表相关,当对表执行INSERT、DELETE或UPDATE语句时,将激活触发程序。可以将触发程序设置为在执行语句之前或之后激活。例如,可以在从表中删除每一行之 ......

MySQL管理员指南之

稳故而知新,最近又用到了,草草拿来温习一下:转自 http://www.bccn.net/Article/sjk/mysql/jc/200601/3411.html
MySQL管理员应该知道如何设置MySQL用户账号,指出哪个用户可以连接服务器,从哪里连接,连接后能做什么。MySQL
3.22.11开始引入两条语句使得这项工作更容易做:GRANT语句创建MySQL用户并指定其权限,而REV ......

mysql 找回密码

 
1.  停到运行的mysql:    /etc/init.d/mysql stop
2.  使用skip-grant-tables这个选项启动MySQL:  /usr/bin/mysqld_safe --skip-grant-tables &
3.  现在可以不用密码进入mysql 了。
     #  myql
    >   ......

java,php,mysql时间处理

java中时间戳和时间字符串之间的转换
获取当前的unix时间戳
new Date().getTime()
System.currentTimeMillis()
返回的是毫秒数,要转换long t = System.currentTimeMillis()/1000;
获取当前年月日以及时分秒
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR))  c.get(Calendar.YEAR))  c.get(C ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号