MySQL ALTERÓï·¨
ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
or ADD INDEX [index_name] (index_col_name,...)
or ADD PRIMARY KEY (index_col_name,...)
or ADD UNIQUE [index_name] (index_col_name,...)
or ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
or CHANGE [COLUMN] old_col_name create_definition
or MODIFY [COLUMN] create_definition
or DROP [COLUMN] col_name
or DROP PRIMARY KEY
or DROP INDEX index_name
or RENAME [AS] new_tbl_name
or table_options
eg:
mysql> alter table topics change hotico hot_count int(4);
mysql> alter table topics alter hot_count set default 1;
²¹³ä£º
¼ÓË÷Òý
mysql> alter table ±íÃû add index Ë÷ÒýÃû (×Ö¶ÎÃû1[£¬×Ö¶ÎÃû2 …]);
Àý×Ó£º mysql> alter table employee add index emp_name (name);
¼ÓÖ÷¹Ø¼ü×ÖµÄË÷Òý
mysql> alter table ±íÃû add primary key (×Ö¶ÎÃû);
Àý×Ó£º mysql> alter table employee add primary key(id);
¼ÓΨһÏÞÖÆÌõ¼þµÄË÷Òý
mysql> alter table ±íÃû add unique Ë÷ÒýÃû (×Ö¶ÎÃû);
Àý×Ó£º mysql> alter table employee add unique emp_name2(cardnumber);
²é¿´Ä³¸ö±íµÄË÷Òý
mysql> show index from ±íÃû;
Àý×Ó£º mysql> show index from employee;
ɾ³ýij¸öË÷Òý
mysql> alter table ±íÃû drop index Ë÷ÒýÃû;
Àý×Ó£º mysql>alter table employee drop index emp_name;
ÐÞ¸Ä±í£ºÔö¼Ó×ֶΣºmysql> ALTER TABLE table_name ADD field_name field_type;
²é¿´±í£ºmysql> SELECT * from table_name;
ÐÞ¸ÄÔ×Ö¶ÎÃû³Æ¼°ÀàÐÍ£ºmysql> ALTER TABLE table_name CHANGE old_field_name new_field_name field_type;
ɾ³ý×ֶΣºALTER TABLE table_name DROP field_name;
Ïà¹ØÎĵµ£º
import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
public static void main(String[] args)throws Exception {
Connection conn=null;
//====Á¬½ÓACCESSÊý¾Ý¿â ......
1.CREATE USER
CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
[, user [IDENTIFIED BY [PASSWORD] 'password']] ...
CREATE USERÓÃÓÚ´´½¨ÐµÄMySQLÕË»§¡£ÒªÊ¹ÓÃCREATE USER£¬Äú±ØÐëÓµÓÐmysqlÊý¾Ý¿âµÄÈ«¾ÖCREATE USERȨÏÞ£¬»òÓµÓÐINSERTȨÏÞ¡£¶ÔÓÚÿ¸öÕË»§£¬CREATE USER»áÔÚûÓÐȨÏÞµÄmysq ......
10055:ûÓлº´æ¿Õ¼ä¿ÉÀûÓà ·½·¨:²é¿´ÏÂÄãµÄCÅÌ¿Õ¼äÊÇ·ñÒѾÂú,Çå³ýһЩûÓÐÓõÄÎļþ. ¿ÉÒÔÔÚºǫ́µÄ"ÂÛ̳ºËÐÄÉèÖÃ","ºËÐŦÄÜÉèÖÃ"Àï"½ø³ÌÓÅ»¯"¿ªÆô,"GZIP ѹËõÊä³ö"¹Ø±Õ. ²éÕÒÁËÒ»ÏÂ10055£¨Ã»Óлº´æ
˵Ã÷:Èç¹ûÓöµ½Êý¾Ý¿â³ö´íµÄÎÊÌâÐÞ¸ÄÏàÓ¦µÄ´úÂëºóÒ»°ãÒªÖØÆômysql¡£Èç¹ûÓöµ½mysqlµÄÎÊÌâ¿ÉÒÔÏÈÖØÆ ......
Ç°²»¾ÃÍøÉϹ«¿ªÁËÒ»¸öMySQL FuncµÄ©¶´,½²µÄÊÇʹÓÃMySQL´´½¨Ò»¸ö×Ô¶¨ÒåµÄº¯Êý,È»ºóͨ¹ýÕâ¸öº¯ÊýÀ´¹¥»÷·þÎñÆ÷¡£×îÔç¿´µ½Ïà¹ØµÄ±¨µÀÊÇÔÚo-otikÉÏ,µ«Êǹ«²¼µÄÊÇÕë¶Ô UnixϵͳµÄExploit,²¢Çҳɹ¦ÂÊÒ²²»ÊǺܸß.¶ø½üÆÚ,¹úÄÚÓиßÊַųöÕë¶ÔWinϵͳµÄÏà¹ØÎÄÕÂ,ÓÚÊÇÎÒÂíÉÏÕÒÀ´ÓëÅóÓÑһͬÑо¿.
ÆäʵÎÒÃÇÔç¾ÍÄÜÏëµ½.µ±ÎÒÃÇÔÚ¶ÔMSSQL ......