Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : mysql

MySql ±íµÄÖ÷¼üË÷ÒýÎÊÌâ

²é¿´Ä³¸ö±íµÄ½¨±íÓï¾ä £ºshow create table data_statdata;
drop index ts on data_statdata;
Ë÷ÒýÊǼÓËÙ²éѯµÄÖ÷ÒªÊֶΣ¬Ìرð¶ÔÓÚÉæ¼°¶à¸ö±íµÄ²éѯ¸üÊÇÈç´Ë¡£±¾½ÚÖУ¬½«½éÉÜË÷ÒýµÄ×÷Óá¢Ìص㣬ÒÔ¼°´´½¨ºÍɾ³ýË÷ÒýµÄÓï·¨¡£
13.4.1 ʹÓÃË÷ÒýÓÅ»¯²éѯ
Ë÷ÒýÊÇ¿ìËÙ¶¨Î»Êý¾ÝµÄ¼¼Êõ£¬Ê×ÏÈͨ¹ýÒ»¸öʾÀýÀ´Á˽âÆ京Òå¼°×÷Óã¬ÏêϸµÄ½éÉÜÇë²Î¿¼µÚ14Õ¡£
1£®Ë÷ÒýʾÀý
¼ÙÉè¶ÔÓÚ10.3½ÚËù½¨µÄ±í£¬¸÷¸ö±íÉ϶¼Ã»ÓÐË÷Òý£¬Êý¾ÝµÄÅÅÁÐҲûÓйæÂÉ£¬Èç±í13.3Ëùʾ¡£
±í13.3                                                     ûÓÐË÷ÒýµÄstudents±í
sid
sname
sgender
sage
52
zhang
M
21
22
wang
M
22
33
li
F
19
41
zhao
M
20
...
...
...
µ±²éÕÒij¸öѧÉúÐÅϢʱ£¬±ØÐë˳Ðò²é¿´±ístudentsÖеÄÿһÐУ¬¼ì²éÊÇ·ñÓëËùÐèֵƥÅ䣬ÕâÐèҪɨÃèÈ«±í£¬Ð§Âʺܵ ......

mysqlÔÚcmdϵÄһЩÓï¾ä

ÉèÖÃ×ֶεÄĬÈÏÖµ£º
    ´´½¨±íµÄʱºò£ºcreate table
tablename(columnname columntype default
defaultvalue);
    Ð޸ıíµÄʱºò£ºalter table
tablename alter column
columnname set 
default
deflaultvalue; ......

phpÁ¬½Ómysql²âÊÔºÍÅäÖÃ


phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall   to   undefined   function   'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã»ÅäÖúÃ, php5 µÄĬÈÏ mysql ÊǹرյÄ
½«php_mysql.dllºÍlibmysql.dllÎļþ¿½±´ÖÁc:\winnt\system32ÖУ¨ÎÒ©ÁËlibmysql.dll£©
ÕÒµ½php.iniÖеÄ;extension=php_mysql,È¥µôÇ°ÃæµÄ";"   ÖØÆô·þÎñÆ÷.
......

phpÁ¬½Ómysql²âÊÔºÍÅäÖÃ


phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall   to   undefined   function   'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã»ÅäÖúÃ, php5 µÄĬÈÏ mysql ÊǹرյÄ
½«php_mysql.dllºÍlibmysql.dllÎļþ¿½±´ÖÁc:\winnt\system32ÖУ¨ÎÒ©ÁËlibmysql.dll£©
ÕÒµ½php.iniÖеÄ;extension=php_mysql,È¥µôÇ°ÃæµÄ";"   ÖØÆô·þÎñÆ÷.
......

mysqlÖ÷´ÓÊý¾Ý¿â²Ù×÷

Ö÷£º
show master status;
+-----------------+------------+-------------------+-----------------------+
| File                |
Position     | Binlog_Do_DB   | Binlog_Ignore_DB |
+-----------------+------------+-------------------+-----------------------+
|    log.000003
|           98  | repl                 |
mysql                    |
+-----------------+------------+-------------------+-----------------------+
´Ó£º
slave stop;
change master to
master_host='192.168.1.222',master_user='repl',master_password='123456',
master_log_file='log.000003' ,master_log_pos=98;
slave start;
show slave
status\G;
ÆäËü»ù±¾ÅäÖÃgoogl ......

Õýȷɾ³ýMYSQlÈÕÖ¾·½·¨

1.²éÕÒµ±
mysql> show binary logs;
+—————-+———–+
| Log_name | File_size |
+—————-+———–+
| mysql-bin.000001 | 150462942 |
| mysql-bin.000002 | 125 |
| mysql-bin.000003 | 106 |
+—————-+———–+
2.ɾ³ýbin-log(ɾ³ýmysql-bin.000003֮ǰµÄ¶øûÓаüº¬mysql-bin.000003)
mysql> purge binary logs to ‘mysql-bin.000003′;
Query OK, 0 rows affected (0.16 sec)
3. ²éѯ½á¹û(ÏÖÔÚÖ»ÓÐÒ»Ìõ¼Ç¼ÁË.)
mysql> show binlog events\G
*************************** 1. row ***************************
Log_name: mysql-bin.000003
Pos: 4
Event_type: Format_desc
Server_id: 1
End_log_pos: 106
Info: Server ver: 5.1.26-rc-log, Binlog ver: 4
1 row in set (0.01 sec)
(mysql-bin.000001ºÍmysql-bin.000002Òѱ»É¾³ý)
mysql> show binary logs;
+—————-+———–+
| Log_name | File_size |
+ ......

mysqlÌí¼ÓÓû§

mysqlÌí¼ÓÓû§·½·¨ 
½¨Á¢Êý¾Ý¿âgamesp
create database gamesp;
Ìí
¼ÓÓû§
grant  all  on  Êý¾Ý¿âÃû.*   to   Óû§
Ãû
@localhost  identified  by  'ÃÜÂë';
grant all on gamesp.* to
newuser@localhost
identified by
'password';
˵Ã÷£º
£¨1£©grant all ¸³ÓèËùÓеÄȨÏÞ
£¨2£©gamesp.* Êý¾Ý¿â gamesp ÖÐËùÓеıí
£¨3£©newuser Óû§Ãû
£¨4£©@localhost ÔÚ±¾µØµçÄÔÉ쵀 mysql server ·þÎñÆ÷
£¨5£©identfified by 'password' ÉèÖÃÃÜÂë
ɾ³ýÓû§
use mysql
mysql
>Delete
from user Where User="xxxxx" and Host="localhost";
mysql
>flush
privileges;
......
×ܼǼÊý:2220; ×ÜÒ³Êý:370; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [1] [2] [3] [4] 5 [6] [7] [8] [9] [10]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ