1、更新多条数据
# $sql = "UPDATE mytable SET myfield1 = CASE id WHEN 1 THEN 'myvalue11' WHEN 2 THEN 'myvalue12' WHEN 3 THEN 'myvalue13' END, myfield2 = CASE id WHEN 1 THEN 'myvalue21' WHEN 2 THEN 'myvalue22' WHEN 3 THEN 'myvalue23' END WHERE id IN (1,2,3) "; #使用INSERT INTO语句更新多条数据的例子 INSERT INTO t_member (id, name, email) VALUES (1, 'nick', 'nick@126.com'), (4, 'angel','angel@163.com'), (7, 'brank','ba198@126.com') ON DUPLICATE KEY UPDATE name=VALUES(name), email=VALUES(email); 注意:ON DUPLICATE KEY UPDATE只是MySQL的特有语法,并不是SQL标准语法!
2、用户授权
GRANT select ON *.* TO 'user_name'@'%' IDENTIFIED BY "your_passwd";
GRANT ALL PRIVILEGES ON *.* TO '58coin'@'%' IDENTIFIED BY PASSWORD '*47EADFF3134CED9A0892A238F5E4A04' WITH GRANT OPTION