MysqlÖд´½¨Óû§ÕÊ»§µÄ·½·¨
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»áÔÚûÓÐȨÏÞµÄmysql.user±íÖд´½¨Ò»¸öмǼ¡£Èç¹û ÕË»§ÒѾ´æÔÚ£¬Ôò³öÏÖ´íÎó¡£
ʹÓÃ×ÔÑ¡µÄIDENTIFIED BY×Ӿ䣬¿ÉÒÔΪÕË»§¸ø¶¨Ò»¸öÃÜÂë¡£userÖµºÍ ÃÜÂëµÄ¸ø¶¨·½·¨ºÍGRANTÓï¾äÒ»Ñù¡£ÌرðÊÇ£¬ÒªÔÚ´¿Îı¾ÖÐÖ¸¶¨ÃÜÂ룬ÐèºöÂÔPASSWORD¹Ø¼ü´Ê¡£Òª°Ñ ÃÜÂëÖ¸¶¨ÎªÓÉPASSWORD()º¯Êý·µ»ØµÄ»ì±àÖµ£¬Ðè°üº¬¹Ø¼ü×ÖPASSWORD¡£
2.ʹÓÃGRANTÓï¾ä
×îºÃµÄ·½·¨ÊÇʹÓÃGRANTÓï¾ä£¬ÒòΪÕâÑù¸ü¾«È·£¬´íÎóÉÙ¡£´ÓMySQL 3.22.11ÆðÌṩÁËGRANT£»ËüµÄÖ÷ÒªÓÃ;ÊÇÀ´¸øÕÊ»§ÊÚȨµÄ£¬µ«Ò²¿ÉÓÃÀ´½¨Á¢ÐÂÕÊ»§²¢Í¬Ê±ÊÚȨ¡£×¢Ò⣺µ±mysqlÔËÐÐÓÚno_auto_create_userʱҪÌṩн¨Óû§µÄÃÜÂ룬·ñÔò²»ÄÜ´´ÐÂÓû§¡£
ÏÂÃæµÄʾÀý˵Ã÷ÈçºÎʹÓÃMySQL¿Í»§¶Ë³ÌÐòÀ´ÉèÖÃÐÂÓû§¡£
Ê×ÏÈ£¬Ê¹ÓÃMySQL³ÌÐòÒÔMySQL rootÓû§À´Á¬½Ó·þÎñÆ÷£º
shell> MySQL --user=root MySQL
Èç¹ûÄãΪrootÕË»§Ö¸¶¨ÁËÃÜÂ룬»¹ÐèҪΪ¸ÃMySQLÃüÁîºÍ±¾½ÚÖеÄÆäËüÃüÁîÌṩ--password»ò-pÑ¡Ïî¡£
ÒÔrootÁ¬½Óµ½·þÎñÆ÷ÉϺ󣬿ÉÒÔÌí¼ÓÐÂÕË»§¡£ÏÂÃæµÄÓï¾äʹÓÃGRANTÀ´ÉèÖÃËĸöÐÂÕË»§£º
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
-> IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
mysql> GRANT USAGE ON *.* TO 'dummy'@'localhost';
ÓÃGRANTÓï¾ä´´½¨µÄÕË»§ÓÐÏÂÃæµÄÊôÐÔ£º
· ÆäÖÐÁ½¸öÕË»§ÓÐÏàͬµÄÓû§ÃûmontyºÍÃÜÂësome_pass¡£Á½¸öÕË»§¾ùΪ³¬¼¶Óû§ÕË»§£¬¾ßÓÐÍêÈ«µÄȨÏÞ¿ÉÒÔ×öÈκÎÊÂÇé¡£Ò»¸öÕË»§ ('monty'@'localhost')Ö»ÓÃÓÚ´Ó±¾»úÁ¬½Óʱ¡£ÁíÒ»¸öÕË»§('monty'@'%')¿ÉÓÃÓÚ´ÓÆäËüÖ÷»úÁ¬½Ó¡£Çë×¢ÒâmontyµÄÁ½¸öÕË»§±ØÐëÄÜ´ÓÈκÎÖ÷»úÒÔmontyÁ¬½Ó¡£Ã»ÓÐlocalhostÕË»§£¬µ±monty´Ó±¾»úÁ¬½Óʱ£¬mysql_install_db´´½¨µÄlocalhostµÄÄäÃûÓû§ÕË»§½«Õ¼ÏÈ¡£½á¹ûÊÇ£¬monty½«±»
Ïà¹ØÎĵµ£º
MySQL³£ÓõĴ洢ÒýÇæΪMyISAM¡¢InnoDB¡¢MEMORY¡¢MERGE£¬ÆäÖÐInnoDBÌṩÊÂÎñ°²È«±í£¬ÆäËû´æ´¢ÒýÇ涼ÊÇ·ÇÊÂÎñ°²È«±í¡£
MyISAMÊÇMySQLµÄĬÈÏ´æ´¢ÒýÇæ¡£MyISAM²»Ö§³ÖÊÂÎñ¡¢Ò²²»Ö§³ÖÍâ¼ü£¬µ«Æä·ÃÎÊËٶȿ죬¶ÔÊÂÎñÍêÕûÐÔûÓÐÒªÇó¡£
InnoDB´æ´¢ÒýÇæÌṩÁ˾ßÓÐÌá½»¡¢»Ø¹öºÍ±ÀÀ£»Ö¸´ÄÜÁ¦µÄÊÂÎñ°²È«¡£µ«ÊDZÈÆðMyISAM´æ´ ......
MySqlÊý¾Ý¿âµÄÁÐÀàÐÍ£¨×Ö¶ÎÀàÐÍ)
MySQLÊý¾Ý¿âµÄ±íÊÇÒ»¸ö¶þά±í£¬ÓÉÒ»¸ö»ò¶à¸öÊý¾ÝÁй¹³É¡£
ÿ¸öÊý¾ÝÁж¼ÓÐËüµÄÌض¨ÀàÐÍ£¬¸ÃÀàÐ;ö¶¨ÁËMySQLÈçºÎ¿´´ý¸ÃÁÐÊý¾Ý£¬ÎÒÃÇ¿ÉÒÔ°ÑÕûÐÍÊýÖµ´æ·Åµ½×Ö·ûÀàÐ͵ÄÁÐÖУ¬MySQLÔò»á°ÑËü¿´³É×Ö·û´®À´´¦Àí¡£
MySQLÖеÄÁÐÀàÐÍÓÐÈýÖÖ£ºÊýÖµÀà¡¢×Ö·û´®ÀàºÍÈÕÆÚ/ʱ¼äÀà¡£
´Ó´óÀàÀ´¿´ÁÐÀàÐͺÍÊýÖ ......
MysqlÔÚĬÈÏÇé¿öϽ¨Á¢±íµÄ×Ö·û±àÂëÊÇlatin1£¬ËùÒÔÔÚ²åÈëÖÐÎÄʱ»á³ö´í¡£
eg£º
1¡¢²é¿´±í½¨Á¢µÄsqlÔ´Â룺
1: sqlÃüÁshow create table users
2:
3: ½á¹û£º
4: CREATE TABLE `users` (
5: `userID` int(10) unsigned NOT NULL AUTO_INCREMENT,
6: `userName` varchar(4 ......
1.´Óhttp://prdownloads.sourceforge.net/mysqldrivercs/MySQLDriverCS-n-EasyQueryTools-3.0.18.exe?downloadÉÏÏÂÔØMySQLDriverCS.
2.°ÑMySQLDriverCS.dll.Ìí¼Óµ½.netµÄ×é¼þ
3.ʹÓ÷½·¨
ÏÂÃæÊÇ´´½¨Ò»¸öÊý¾Ý¿âÁ´½Ó:
ÏÂÃæÊÇ´´½¨Ò»¸öÊý¾Ý¿âÁ´½Ó:
using MySQLDriverCS;
MySQLConnection conn ......
mysql> use information_schema
Database changed
mysql> select concat(round(sum(index_LENGTH)/(1024*1024),2),'MB') as 'Data Size' from tables where table_schema='bbs';
+-----------+
| Data Size |
+-----------+
| 0.00MB |
+-----------+
1 row in set (0.01 sec)
½âÊÍ£º
......