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

mysql5的字符集和sql mode问题

http://hi.baidu.com/gushu/blog/item/3e821c174eabec064a90a7d4.html
mysql5添加了一些新的功能的规则,其中对开源程序影响比较大的有两个,一个是4.0.12+开始的4层次字符集,一个是5.0.18开始的默认strict mode。
对于这两个问题,效率最好的解决方案,就是直接修改my.ini
# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=utf8
#这里改成utf-8
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION"
#这里改成=""
当你没有权限进行修改时,就只好在程序中判断了mysql5 新功能,必须在每次连接上数据库时进行设定。在使用了数据库抽象层的程序中修改起来也很简单:
if(mysql_get_server_info( $connect ) > '4.0.1')
{
mysql_query( "set names 'utf8'" , $connect );
}
if(mysql_get_server_info( $connect ) > '5.0.1')
{
mysql_query("SET sql_mode=''" , $connect );
}


相关文档:

sql权限

sql权限:
创建User:
insert into mysql.user(Host,User,Password)
values("localhost","cordev",password("xasoftorg"));
insert into
mysql.user(Host,User,Password)
values("localhost","corhotfix",password("xasoftorg"));
insert into
mysq ......

mysql 修复命令 king of

Mysql在运行一段时间后,随着库容量的增大,表的增多,有的时候因为掉电或者其他原因导致数据库损坏,比如: 检查优化并修复所有的数据库,我们可以使用mysql自带的mysqlcheck命令来快速修复所有的数据库或者特定的数据库; 进入Mysql的Bin目录:d:\MySQL\MySQL Server 4.1\bin or /usr/bin/
(ls my* 显示my开头的文件) ......

mysql函数

now()函数以`yyyy-mm-dd hh:mm:ss返回当前的日期时间,可以直接存到datetime字段中。
curdate()以’yyyy-mm-dd’的格式返回今天的日期,可以直接存到date字段中。
curtime()以’hh:mm:ss’的格式返回当前的时间,可以直接存到time字段中。 ......

MySQL程序剖析(Profiling)

我们将要详细的讲到MySQL的剖析(Profiling),因为它很少依赖于你的应用。应用和服务器级别的剖析有的时候都是有必要的。虽然应用级别的剖析可以给你整个应用性能的总揽。,但是对MySQL的剖析提供了信息是服务器级别所提供不了的。比如,对PHP代码进行剖析不会显示MySQL有多少行语句执行了。
 
与应用剖析一样,目标是 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号