change password
mysqladmin -u root password 123456

permit remote login
update user set Host='%' where Host='$hostname';
delete from user where Host in ('127.0.0.1', '::1', 'localhost');
CREATE DATABASE IF NOT EXISTS db DEFAULT CHARSET utf8 COLLATE utf8_general_ci

drop database db


dbproxy:读写分离

split, SqlTransformer


MYSQLI_USE_RESULT

MYSQLI_STORE_RESULT 传输整个记录集到客户端.


使用mysqli_fetch_assoc()和mysqli_fetch_row()都是把查询结果返回到一个数组中,都是返回第一行然后指针下移一行。

mysqli_fetch_assoc()用关键字索引取值。比如:
$row = $result->fetch_assoc();
echo $row['username'];

mysqli_fetch_row()用数字索引取值。比如:
$row = $result->fetch_row();
echo $row[0];//注:“0”的意思是表中的第一个字段(即username是表中的第一个字段)。

mysqli_fetch_object()将一行取回到一个对象中,然后通过类的方式取值,比如:
$row = $result->fetch_object();
echo $row->username;


select UNIX_TIMESTAMP('2014-10-29 21:00');

select FROM_UNIXTIME(1156219870);


column order:

AFTER column