mysql ´´½¨Óû§·½·¨
ÃüÁʽµÄ.×¢ÒâÿÐкó±ß¶¼¸ú¸ö £» ±íʾһ¸öÃüÁîÓï¾ä½áÊø.
¸ñʽ£ºgrant select on Êý¾Ý¿â.* to
Óû§Ãû@µÇ¼Ö÷»ú identified by "ÃÜÂë"
Àý1¡¢Ôö¼ÓÒ»¸öÓû§test1ÃÜÂëΪabc£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔ
rootÓû§Á¬ÈëMYSQL
£¬
È»ºó¼üÈëÒÔÏÂÃüÁ
grant select,insert,update,delete on *.* to test1@"%"
Identified by "abc";
µ«Àý1Ôö¼ÓµÄÓû§ÊÇÊ®·ÖΣÏյģ¬ÄãÏëÈçij¸öÈËÖªµÀtest1µÄÃÜÂ룬ÄÇôËû¾Í¿ÉÒÔÔÚinternetÉϵÄÈκÎһ̨µçÄÔÉϵǼÄãµÄmysql
Êý¾Ý¿â
²¢¶ÔÄãµÄÊý¾Ý¿ÉÒÔΪËùÓûΪÁË£¬½â¾ö°ì·¨¼ûÀý2¡£
Àý2¡¢Ôö¼ÓÒ»¸öÓû§test2ÃÜÂëΪabc,ÈÃËûÖ»¿ÉÒÔÔÚlocalhostÉϵǼ£¬²¢¿ÉÒÔ¶ÔÊý¾Ý¿âmydb½øÐвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾
³ýµÄ²Ù×÷£¨localhostÖ¸±¾µØÖ÷»ú£¬¼´MYSQL
Êý¾Ý¿âËùÔÚµÄÄÇ̨Ö÷»ú£©£¬ÕâÑùÓû§¼´Ê¹ÓÃÖªµÀtest2µÄÃÜÂ룬ËûÒ²ÎÞ·¨´ÓinternetÉÏÖ±½Ó·ÃÎÊÊý¾Ý
¿â£¬Ö»ÄÜͨ¹ýMYSQL
Ö÷
»úÉϵÄwebÒ³À´·ÃÎÊÁË¡£
grant select,insert,update,delete on mydb.* to test2@localhost
identified by "abc";
Èç¹ûÄã²»Ïëtest2ÓÐÃÜÂ룬¿ÉÒÔÔÙ´òÒ»¸öÃüÁÃÜÂëÏûµô¡£
grant
select,insert,update,delete on mydb.* to test2@localhost identified by
"";
Ïà¹ØÎĵµ£º
Mysql·½Ê½£º
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MysqlDB {
private String strClass = "com.mysql.jdbc.Driver";
private String strDriver = "jdbc:mysql://localhost: ......
½ñÌìÎÒÃÇ¿´¿´¹ØÓÚMySQLÂýÈÕÖ¾µÄÔĶÁ¡£
ÎÒÃÇÖªµÀ£¬Èç¹ûÎÒÃǵÄÓï¾ä²»¹»ÓÅ»¯£¬ÄÇôÊ×ÏÈMySQLµÄÂýÈÕÖ¾ÊǽøÒ»²½ÓÅ»¯µÄÀëÏßÖ¤¾Ý£¬ËäÈ»ÀïÃæÓкÃ
¶à“αÂýÓï¾ä”£¡
ÏȲ»ËµÔõôÓÅ»¯£¬Èç¹ûÄãµÄÈÕÖ¾ÓÐÒ»ÌõÓï¾ä¶ÄסÁË£¬ÄÇô»áÓв»¼ÆÆäÊýµÄÂýÓï¾äÌî³äµ½MySQLµÄÂúÈÕÖ¾ÀïÃæ¡£ÄÇôÊ×ÏÈÌáÁ¶³öÕâЩÓï
¾ä¾Í·Ç³£Í·ÌÛ¡£
½ñÌìÖ÷Òª½ ......
ÕâÁ½ÌìÕýÔÚ²âMYSQLµÄÐÔÄÜ£¬°´ÕÕMYSQLÎĵµÖÐÍƼöµÄÉèÖã¬ÐÞ¸ÄÁ˼¸¸öϵͳ±äÁ¿
innodb_buffer_pool_size=1G
innodb_log_file_size=250M
innodb_log_buffer_size=8M
½á¹ûMYSQL±ÀÁË¡£mysql¿Í»§¶ËÄܵǼ£¬µ«Ö»ÒªÖ´ÐÐÈκÎÃüÁmysqldÁ¢¿Ì±Àµô¡£
¿ªÊ¼»¹ÒÔΪÊÇinnodb_buffer_pool_sizeµÈ¼¸¸ö²ÎÊýÉèµÃÌ«´óÁË£¬¿ÉÊǵ÷ÕûÁ˼¸´Î¶ ......
windows주
½â¾ö°ì·¨£º
1.¼ì²éÄãµÄMysqlĿ¼ÓÐûÓиøϵͳµÄSystemÓû§È¨ÏÞ¡£
2.ɾ³ýµôÄãµÄ %WINDOWS%/my.ini Îļþ¡£
3.¼ì²éÄãµÄ c:/my.cnf ÎļþÅäÖÃÊÇ·ñÕýÈ·¡£
ÐÞ¸Ä%windir%\my.ini£¬Ôö¼Ó
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=D:\Program\Tools\mysql
datadir=D:\Program\Tools\mysql\data& ......
1¡¢¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý
2¡¢É¾³ýMySQLÎļþ¼ÐϵÄmy.iniÎļþ£¬Èç¹û±¸·ÝºÃ£¬¿ÉÒÔÖ±½Ó½«Îļþ¼ÐÈ«²¿É¾³ý
3¡¢¿ªÊ¼->ÔËÐÐ-> regedit ¿´¿´×¢²á±íÀïÕ⼸¸öµØ·½É¾³ýûÓÐ
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL Ŀ¼ɾ³ý
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\S ......