Skip to content

Category Archives: mysql

mysql_insert_id()错误

24-Jan-09

mysql_insert_id –  取得上一步 INSERT 操作产生的 ID
int mysql_insert_id ( [resource link_identifier])
mysql_insert_id() 返回给定的 link_identifier 中上一步 INSERT 查询中产生的 AUTO_INCREMENT 的 ID 号。如果没有指定 link_identifier,则使用上一个打开的连接。
如果上一查询没有产生 AUTO_INCREMENT 的值,则 mysql_insert_id() 返回 0。如果需要保存该值以后使用,要确保在产生了值的查询之后立即调用 mysql_insert_id()。

注: [...]

终于知道wordpress越来越慢的原因(一)

05-Oct-08

最近服务器速度越来越慢,有时候服务器负载经常到达十几甚至看到过二十。博客打开的速度也慢了起来,今天花…

mysql慢速(slow log)脚本分析

04-Oct-08

mysql有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,
要修改…

MySQL中设置自增字段

16-Aug-08

MySQL中设置自增字段

alter table album change ALBUM_ID ALBUM_ID bigint not null auto_increment;
alter table album auto_increment=1;

创建:
mysql>create table cc(id int auto_increment,name varchar(20),primary key(id));
修改:
mysql> alter table cc change id id int primary key auto_increment;

mysql优化脚本!

16-Aug-08

[mysqld]
#port = 3306
#socket = /tmp/mysql.sock
#socket = /var/lib/mysql/mysql.sock
#skip-locking
key_buffer = 128M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
net_buffer_length = 16K
myisam_sort_buffer_size = 1M
max_connections=120
#addnew config
wait_timeout =120…