MySQL¼¯Èº
1£¬½«6.0°æ±¾µÄmysql¼¯ÈºÈí¼þÉÏ´«µ½Linux»òÊÇSolarisÉÏ£¬½âѹ
1>£¬ÎªÁË·½±ãµ÷Óý«Æä¸ÄÃûΪmysql£¬²¢ÇÒ·ÅÓÚ/usr/local/ÏÂ
2>£¬´´½¨Á¬½ÓÎļþ£¬½øÈë/usr/local/ÏÂ
ln -s ..../mysql mysql
2£¬´´½¨×飬Ìí¼ÓÓû§
groupadd mysql
useradd -g mysql mysql
3£¬È¨ÏÞµÄÐÞ¸Ä
cd /usr/local/mysql
chown -Rhf mysql .
chgrp -Rhf mysql .
Ö´Ðнű¾£¬´´½¨Êý¾Ý¿â
scritps/mysql_install_db --user=mysql &
chown -Rhf root .
chown -Rhf mysql .
chown -R mysql data
chgrp -R mysql .
cp support-file/mysql.server /etc/rc.d/ini.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
<chkconfig - add mysqld>
ÑéÖ¤Æô¶¯Êý¾Ý¿â
Æô¶¯Ê§°Ü¿ÉÒÔ³¢ÊÔ£º
/etc/rc.d/init.d/mysqld stop/start
service mysqld restart
Èç¹û»¹ÊÇʧ°Ü
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
bin/mysqld_safe --user=mysql &
ÑéÖ¤³É¹¦ºó£¬Í£Ö¹mysql£¬Í£Ö¹½ø³Ì
ps -ef | grep mysql<ndb>
kill -9 ½ø³Ì±êºÅ
4£¬´´½¨ÅäÖÃÎļþ
vi my.cnf
[mysqld]
default-storage-engine=ndbcluster
ndbcluster
ndb-connectstring=10.85.0.90,10.85.0.80
[ndbd]
connect-string=10.85.0.90,10.85.0.80
[ndb_mgm]
connect-string=10.85.0.90,10.85.0.80
[ndb_mgmd]
config-file=/usr/local/mysql/config.ini
[mysql_cluster]
ndb-connectstring=10.85.0.90,10.85.0.80
5£¬´´½¨Æô¶¯Îļþ
vi config.ini
[ndbd default]
NoOfReplicas= 2
MaxNoOfConcurrentOperations= 10000
DataMemory= 80M
IndexMemory= 24M
TimeBetweenWatchDogCheck= 30000
DataDir= /var/lib/mysql-cluster
MaxNoOfOrderedIndexes= 512
StartPartialTimeout=100
StartPartitionedTimeout=100
ArbitrationTimeout=5000
TransactionDeadlockDetectionTimeout=5000
HeartbeatIntervalDbDb=5000
StopOnError=0
[ndb_mgmd default]
DataDir= /var/lib/mysql-cluster
[ndb_mgmd]
Id=1
HostName= 10.85.0.90
[ndb_mgmd]
Id=2
Ho
Ïà¹ØÎĵµ£º
CREATE PROCEDURE pro_page(
in _sql varchar(1000),
in _order varchar(1000),
in _pagecurrent int,
in _pagesize int
)
BEGIN
if _pagesize<=1 then
set _pagesize=20;
end if;
if _pagecurrent < 1 then
set _pagecurrent = 1;
&n ......
Ò»,½ñÌì¸ø´ó¼Ò½²Ò»ÏÂ,×öÁôÑÔµÄÒ»ÖÖ×·¼ÓµÄ·½Ê½Ö÷ÒªÈç¹ûµ±Ç°ÓÐÁôÑÔ,¾Í¸üе±Ç°µÄÁôÑÔÒÔ×·¼ÓµÄ·½Ê½,Èç¹ûûÄÜÁôÑԾͽ«ÈëÒ»ÌõеÄ
mysql:insert into `table` (field) values ('$value') on duplicate key update `field`=concat('value',ifnull(`field`,''));
¾ßÌå±¾ÌõSQLµÄÓ÷¨,Çë²é¿´ÊÖ²á
¶þ,½²Ò»ÏÂͳ¼ÆµÄÓ÷¨,Ö÷Òª½éÉÜÈçº ......
Unixʱ¼ä´Á×îСµ¥Î»ÊÇÃ룬¿ªÊ¼Ê±¼äΪ¸ñÁÖÍþÖαê׼ʱ¼ä1970-01-01 00:00:00
ConvertIntDateTime·½·¨µÄ»ù±¾Ë¼Â·ÊÇͨ¹ý»ñÈ¡±¾µØʱÇø±íʾUnixk¿ªÊ¼Ê±¼ä£¬¼ÓÉÏUnixʱ¼äÖµ£¨¼´¹ýÈ¥µÄÃëÊý£©.
ConvertDateTimeInt·½·¨µÄ»ù±¾Ë¼Â·ÊÇͨ¹ý¿Ì¶ÈÊý²î£¬Ôٰѿ̶ÈÊýת»»ÎªÃëÊý£¬µ±È»ÒªËµÃ÷µÄÊÇ£¬ÎÒÕâÀï·µ»ØµÄÊÇdoubleÀàÐÍ£¬ÒâÒåÉϲ¢·ÇÊÇÕæ ......
Ò»¸öÍøÓÑÔÚ̳×ÓÉÏÎʵ½µÄÎÊÌ⣬˵ÓÃMinGW GCC±àÒëÔËÐÐÒ»¸öÁ¬½ÓMySQLÊý¾Ý¿âµÄ³ÌÐòʱÓöµ½´íÎó£º
undefined reference to `mysql_init@4'
undefined reference to `mysql_real_connect@32'
undefined reference to `mysql_close@4'
ÎÒËìÈ¥MySQL¹ÙÍøÏÂÁ˸ö×îеÄWindows C Connect ......
±ÈÈ磺
insert into User values(x1,x2,x3,x4),(x1,x2,x3,x4),(x1,x2,x3,x4)
ÕâÖÖд·¨£¬ÁÐÊýÁ¿±ØÐëºÍ±íÖÐËùÓÐÁб£³ÖÒ»Ö£¬Ò²¾ÍÊÇ˵Áж¼ÒªÁгöÀ´¡£
Õâ¸öuser±íÀïÃæµÄÒ»¸ö×Ö¶Îx1ÊǸö×ÔÔö³¤×ֶΣ¬ÔòÓ¦¸ÃÌînullռλ
insert into User values(null,x2,x3,x4),(null,x2,x3,x4),(null,x2,x3,x4)
·ñÔò»á±¨´í¡£ ......