随笔分类 -  Database

摘要:· 清空用户数据sqlplus / as sysdba>drop user xxx cascade;>create user xxx identified by xxoo;>grant connect,resource,dba to xxx;· 恢复用户数据imp xxx/xxoo@localhost:8987/xxxdb file=zzz.dmp 阅读全文
posted @ 2013-08-24 17:52 easynote 阅读(205) 评论(0) 推荐(0) 编辑
摘要:· 字符串空替换oracle:vnl(string1,replace_with)mysql:ifnull(string1,replace_with)· 逻辑运算oracle:按位与: bitand(),按位或:bitor() 、按位异或:bitxor()mysql:按位与: &,按位或:| 、按位异或:^· 当前时间oracle:select sysdate from dual;mysql:select sysdate();· 日期、时间与字符串转换oracle:to_char(sysdate,'yyyy-mm-dd')oracl 阅读全文
posted @ 2013-08-24 17:43 easynote 阅读(269) 评论(0) 推荐(0) 编辑
摘要:· 常用命令创建数据库:create database databasename;查看数据库:show databases;创建用户:create user 'username'@'%' identified by 'password';创建用户:grant select,insert,update,delete on dbname.* to username@'%' identified by "password";分配权限:grant ALL PRIVILEGESon *.* to 'su 阅读全文
posted @ 2013-08-24 17:23 easynote 阅读(358) 评论(0) 推荐(0) 编辑
摘要:使用mysql workbench登陆mysql服务器时提示授权算法错误。查阅资料发现,mysql密码使用有两个阶段,第一阶段是登陆时使用hash value进行验证,第二阶段用password()函数生成密码。换句话说,第一阶段用加密字符串登陆,第二阶段需要更改密码(create user/grant/set password)时使用password()函数来生成。而第一阶段的验证hash value有两种,一种是pre-4.1版本,另一种是4.1版本的,前者是16字节的字符串,后者是41字节的字符串。user表的password的长度也调整到了41字节。新版本的hash value总是以* 阅读全文
posted @ 2013-08-24 15:31 easynote 阅读(3868) 评论(0) 推荐(0) 编辑
摘要:· 安装服务器端yum install mysql-server· 设置开机启动chkconfig --list mysqldchkconfig mysqld --level 2345 onchkconfig --list mysqld· 配置iptableiptables -A INPUT -p tcp --dport 3306 -j ACCEPTservice iptables saveservice iptables restart· 设置支持UTF-81. vi /etc/my.cnf2. 在[mysqld]中加入:default-charact 阅读全文
posted @ 2013-08-23 10:40 easynote 阅读(288) 评论(0) 推荐(0) 编辑