mysqlѧϰ5
Ð޸ĺͱ¸·Ý¡¢Åú´¦Àí
ÓÐʱÎÒÃÇÒª¶ÔÊý¾Ý¿â±íºÍÊý¾Ý¿â½øÐÐÐ޸ĺÍɾ³ý£¬¿ÉÒÔÓÃÈçÏ·½·¨ÊµÏÖ£º
1¡¢Ôö¼ÓÒ»ÁУº
ÈçÔÚÇ°ÃæÀý×ÓÖеÄmytable±íÖÐÔö¼ÓÒ»ÁбíʾÊÇ·ñµ¥Éísingle:
mysql> alter table mytable add column single char(1);
2¡¢Ð޸ļǼ
½«abccsµÄsingle¼Ç¼ÐÞ¸ÄΪ“y”£º
mysql> update mytable set single='y' where name='abccs';
ÏÖÔÚÀ´¿´¿´·¢ÉúÁËʲô£º
mysql> select * from mytable;
+----------+------+------------+-----------+--------+
| name | | birth | birthaddr | single |
+----------+------+------------+-----------+--------+
| abccs |f | 1977-07-07 | china | y |
| mary |f | 1978-12-12 | usa | NULL |
| tom |m | 1970-09-02 | usa | NULL |
+----------+------+------------+-----------+--------+
3¡¢Ôö¼Ó¼Ç¼
Ç°ÃæÒѾ½²¹ýÈçºÎÔö¼ÓÒ»Ìõ¼Ç¼£¬Îª±ãÓڲ鿴£¬Öظ´Óë´Ë£º
mysql> insert into mytable
-> values ('abc','f','1966-08-17','china','n');
Query OK, 1 row affected (0.05 sec)
²é¿´Ò»Ï£º
mysql> select * from mytable;
+----------+------+------------+-----------+--------+
| name | | birth | birthaddr | single |
+----------+------+------------+-----------+--------+
| abccs |f | 1977-07-07 | china | y |
| mary |f | 1978-12-12 | usa | NULL |
| tom |m | 1970-09-02 | usa | NULL |
| abc |f | 1966-08-17 | china | n |
+----------+------+------------+-----------+--------+
3¡¢É¾³ý¼Ç¼
ÓÃÈçÏÂÃüÁîɾ³ý±íÖеÄÒ»
Ïà¹ØÎĵµ£º
ÖØװʱ³öÏÖcould not start the service mysql error:0µÄ´íÎóʱ
ÔÚ¿ØÖÆÃæ°åÖÐÔËÐÐÌí¼Óɾ³ý³ÌÐò£¬½«mysqlжÔØ;
жÔغó´ò¿ª×¢²á±í£¬²é¿´HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services ϵļüÖµ£¬Èç¹ûÓÐÏà¹Ømysql¼üÖµ(mysql¡¢mysqladmin)Ôòɾµô£¬¼´¿É;
ÖØÆô£¬½«mysqlµÄ°²×°²ÐÓàĿ¼ɾµô (²é¿´·þÎñ£¬´Ëʱ·þÎñÖÐÒÑû ......
²âÊÔ»·¾³£ºUbuntu 9.10 + MySQL 5.1.37-1ubuntu5
Ubuntu ÔÚÆô¶¯¹ÜÀí init.d
ÀïÃæ¹ØÓÚ MySQL µÄÃüÁîÓУº
/etc/init.d/mysql start|stop|restart|reload|force-reload|status
ÀýÈçÖØÆôMySQL·þÎñ£ºsudo /etc/init.d/mysql restart
......
±¾À´ÊÇmssql+hibernate+native SQL Ó¦ÓõĺܺÍг
µ«Êǵ½ÁË°Ñmssql»»³Émysql£¬¾Í³öÁË´í(ͬÑùµÄÊý¾Ý½á¹¹ºÍÊý¾Ý)¡£
²éѯ·½·¨ÊÇ£º
String sql =
"select id XXX_ID from t_tab";
List<Map> list = session.createSQLQuery(sql)
.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)
.list();
´í ......
grant replication slave on *.* to backup@192.168.188.128 identified by "123456";
grant replication slave on *.* to backup@192.168.188.8 identified by "123456";
service mysql stop
server_id = 1
log-bin = mysql-bin
log-error=mysql-error
master-host = 192.168.188.8
master-user = ba ......
truncate table Çå¿Õ±í£¬ºÍdeleteÏàËÆ£¬µ«ÊÇÔÚ±í·Ç³£´óµÄʱºò£¬ËüÊÇÖð²½Êͷŵġ£
insert Èç¹ûÔÚ²åÈëʱ£¬Ä³¸ö×ֶδæÔÚ£¬ÎÒÏë¸üпÉÒÔͨ¹ý insert into tablename values() on duplicate key update id=id+1;
insert into tablename values(default) ĬÈÏ×ÔÔö³¤
select last_insert_id() È¡×îºó²åÈëÒ»Ìõ¡£ ......