[ת]mysqlÖÐdata_format()
DATE_FORMAT(date,format)
¸ù¾Ýformat×Ö·û´®¸ñʽ»¯dateÖµ¡£ÏÂÁÐÐÞÊηû¿ÉÒÔ±»ÓÃÔÚformat×Ö·û´®ÖУº %M ÔÂÃû×Ö(January……December)
%W ÐÇÆÚÃû×Ö(Sunday……Saturday)
%D ÓÐÓ¢Óïǰ׺µÄÔ·ݵÄÈÕÆÚ(1st, 2nd, 3rd, µÈµÈ¡££©
%Y Äê, Êý×Ö, 4 λ
%y Äê, Êý×Ö, 2 λ
%a ËõдµÄÐÇÆÚÃû×Ö(Sun……Sat)
%d Ô·ÝÖеÄÌìÊý, Êý×Ö(00……31)
%e Ô·ÝÖеÄÌìÊý, Êý×Ö(0……31)
%m ÔÂ, Êý×Ö(01……12)
%c ÔÂ, Êý×Ö(1……12)
%b ËõдµÄÔ·ÝÃû×Ö(Jan……Dec)
%j Ò»ÄêÖеÄÌìÊý(001……366)
%H Сʱ(00……23)
%k Сʱ(0……23)
%h Сʱ(01……12)
%I Сʱ(01……12)
%l Сʱ(1……12)
%i ·ÖÖÓ, Êý×Ö(00……59)
%r ʱ¼ä,12 Сʱ(hh:mm:ss [AP]M)
%T ʱ¼ä,24 Сʱ(hh:mm:ss)
%S Ãë(00……59)
%s Ãë(00……59)
%p AM»òPM
%w Ò»¸öÐÇÆÚÖеÄÌìÊý(0=Sunday ……6=Saturday £©
%U ÐÇÆÚ(0……52), ÕâÀïÐÇÆÚÌìÊÇÐÇÆڵĵÚÒ»Ìì
%u ÐÇÆÚ(0……52), ÕâÀïÐÇÆÚÒ»ÊÇÐÇÆڵĵÚÒ»Ìì
%% Ò»¸öÎÄ×Ö“%”¡£
ËùÓеÄÆäËû×Ö·û²»×ö½âÊͱ»¸´ÖƵ½½á¹ûÖС£
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
-> 'Saturday October 1997'
mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');
-> '22:23:00'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
'%D %y %a %d %m %b %j');
-> '4th 97 Sat 04 10 Oct 277'
mysql> select DATE_FORMAT('1997-10-04 22:23:00',
'%H %k %I %r %T %S %w');
-> '22 22 10 10:23:00 PM 22:23:00 00 6'
MySQL3.23ÖУ¬ÔÚ¸ñʽÐÞÊηû×Ö·ûÇ°ÐèÒª%¡£ÔÚMySQL¸üÔçµÄ°æ±¾ÖУ¬%ÊÇ¿ÉÑ¡µÄ
Ïà¹ØÎĵµ£º
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySQLDriverCS;
&nb ......
ÏÂÃæÊÇcommond:
MySQLCommand cmd;
cmd = new MySQLDriverCS.MySQLCommand("DROP TABLE IF EXISTS test.mysqldrivercs_test",conn);
cmd.ExecuteNonQuery();
cmd.Dispose();
ÏÂÃæÊÇinsert:
string Value = "Value";
int SettingID = 1;
new MySQLInsertCommand(conn,
new object[,] {{"SettingID",SettingID},{"S ......
MysqlÊý¾Ý¿âÌṩÁ½ÖÖÀàÐ͵ÄË÷Òý£¬Èç¹ûûÕýÈ·ÉèÖã¬Ë÷ÒýµÄÀûÓÃЧÂÊ»á´ó´òÕÛ¿ÛÈ´ÍêÈ«²»ÖªÎÊÌâ³öÔÚÕâ¡£
CREATE TABLE test (
id INT NOT NULL,
last_name CHAR(30) NOT NULL,
first_name CHAR(30) NOT NULL,
PRIMARY KEY (id),
INDEX name (last_name,first_name)
);
ÒÔÉÏ´ ......
±¸·ÝMySQLÊý¾Ý¿âµÄÃüÁî
mysqldump -hhostname -uusername -ppassword databasename > backupfile.sql
±¸·ÝMySQLÊý¾Ý¿âΪ´øɾ³ý±íµÄ¸ñʽ
±¸·ÝMySQLÊý¾Ý¿âΪ´øɾ³ý±íµÄ¸ñʽ£¬Äܹ»Èøñ¸·Ý¸²¸ÇÒÑÓÐÊý¾Ý¿â¶ø²»ÐèÒªÊÖ¶¯É¾³ýÔÓÐÊý¾Ý¿â¡£
mysqldump -–add-drop-table -uusername -ppassword databasename > bac ......
1.µÇ¼MySQLÖÕ¶Ë 2.ÊÚȨ:
ÔÊÐíËùÓлúÆ÷·ÃÎÊMySQL·þÎñÆ÷
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH RIVILEGES;
ÔÊÐíÖ¸¶¨»úÆ÷·ÃÎÊMySQL·þÎñÆ÷
GRANT ALL PRIVILEGES ON *.* TO 'root'@'IPµØÖ·'IDENTIFIED BY 'password' WITH GRANT OPTION; ......