MYSQL³£ÓÃÃüÁ
1¡¢µÇ½MySQL:
mysql -u root -p
2¡¢²é¿´Óû§ÐÅÏ¢
select user,host,password from mysql.user;
select user,host from mysql.user;
3¡¢ÉèÖÃÃÜÂë
set password for root@localhost=password('
ÔÚÕâÀïÌîÈërootÃÜÂë
');
4¡¢ÐÞ¸ÄÃÜÂë
·½·¨1£ºmysqladmin -u root -p password newpassword
·½·¨2£º ££mysql -u root -p mysql
mysql>UPDATE user SET password=PASSWORD("new") WHERE user='root';
mysql>flush privileges;
5
¡¢É¾³ýÄäÃûÓû§
delete from mysql.user where user='';
6
¡¢²é¿´ÏµÍ³ÒÑ´æÔÚµÄÊý¾Ý¿â
show databases;
7¡¢É¾³ýÃûΪtestµÄ¿ÕÊý¾Ý¿â
drop database test;
8¡¢½¨Á¢mysqlÓû§
Àýa:
½¨Á¢¶ÔtestÊý¾Ý¿âÓÐÍêÈ«²Ù×÷ȨÏÞµÄÃûΪcentospubµÄÓû§
mysql>grant all privileges on test.* to centospub@localhost identified by 'password';
Àýb:
Ôö¼ÓÒ»¸öÓû§test1ÃÜÂëΪabc£¬ÈÃËû¿ÉÒÔÔÚÈκÎÖ÷»úÉϵǼ£¬²¢¶ÔËùÓÐÊý¾Ý¿âÓвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄȨÏÞ¡£Ê×ÏÈÓÃÒÔrootÓû§Á¬ÈëMYSQL£¬È»ºó¼üÈëÒÔÏÂÃüÁ
mysql>grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";
µ«ÀýbÔö¼ÓµÄÓû§ÊÇÊ®·ÖΣÏյģ¬ÄãÏëÈçij¸öÈËÖªµÀtest1µÄÃÜÂ룬ÄÇôËû¾Í¿ÉÒÔÔÚinternetÉϵÄÈκÎһ̨µçÄÔÉϵǼÄãµÄmysqlÊý¾Ý¿â²¢¶ÔÄãµÄÊý¾Ý¿ÉÒÔΪËùÓûΪÁË¡£
Àýc:
Ôö¼ÓÒ»¸öÓû§test2ÃÜÂëΪabc,ÈÃËûÖ»¿ÉÒÔÔÚlocalhostÉϵǼ£¬²¢¿ÉÒÔ¶ÔÊý¾Ý¿âmydb½øÐвéѯ¡¢²åÈë¡¢Ð޸ġ¢É¾³ýµÄ²Ù×÷£¨localhostÖ¸±¾µØÖ÷»ú£¬¼´MYSQLÊý¾Ý¿âËùÔÚµÄÄÇ̨Ö÷»ú£©£¬ÕâÑùÓû§¼´Ê¹ÓÃÖªµÀtest2µÄÃÜÂ룬ËûÒ²ÎÞ·¨´ÓinternetÉÏÖ±½Ó·ÃÎÊÊý¾Ý¿â£¬Ö»ÄÜͨ¹ýMYSQLÖ÷»úÉϵÄwebÒ³À´·ÃÎÊÁË¡£
mysql>grant select,insert,update,delete on mydb.* to test2@localhost identified by "abc";
9¡¢²éÕÒ
È·ÈÏcentospubÓû§µÄ´æÔÚÓë·ñ
select user from mysql.user where user='centospub';
10¡¢
½¨Á¢ÃûΪtestµÄÊý¾Ý¿â
create database test;
11
¡¢È¡ÏûcentospubÓû§¶ÔÊý¾Ý¿âµÄ²Ù×÷ȨÏÞ
revoke all privileges on *.* from centospub@localhost;
12
¡¢É¾³ýcentospubÓû§
delete from mysql.user w
Ïà¹ØÎĵµ£º
ÎÒÒ»Ö±ÊÇʹÓÃmysqlÕâ¸öÊý¾Ý¿âÈí¼þ£¬Ëü¹¤×÷±È½ÏÎȶ¨£¬Ð§ÂÊÒ²ºÜ¸ß¡£ÔÚÓöµ½ÑÏÖØÐÔÄÜÎÊÌâʱ£¬Ò»°ã¶¼ÓÐÕâô¼¸ÖÖ¿ÉÄÜ£º
1¡¢Ë÷ÒýûÓн¨ºÃ£»
2¡¢sqlд·¨¹ýÓÚ¸´ÔÓ£»
3¡¢ÅäÖôíÎó£»
4¡¢»úÆ÷ʵÔÚ¸ººÉ²»ÁË£»
1¡¢Ë÷ÒýûÓн¨ºÃ
Èç¹û¿´µ½mysqlÏûºÄµÄcpuºÜ´ó£¬¿ÉÒÔÓÃmysqlµÄclient¹¤¾ßÀ´¼ì²é¡£
ÔÚlinuxÏÂÖ´ÐÐ
/usr/local/mysql/bin/ ......
ÓкܶàÓ¦ÓÃÏîÄ¿, ¸ÕÆð²½µÄʱºòÓÃMYSQLÊý¾Ý¿â»ù±¾ÉÏÄÜʵÏÖ¸÷ÖÖ¹¦ÄÜÐèÇó£¬Ëæ×ÅÓ¦ÓÃÓû§µÄÔö¶à£¬Êý¾ÝÁ¿µÄÔö¼Ó£¬MYSQL½¥½¥µØ³öÏÖ²»¿°ÖظºµÄÇé¿ö£º
Á¬½ÓºÜÂýÉõÖÁå´»ú£¬ÓÚÊǾÍÓаÑÊý¾Ý´ÓMYSQLǨµ½ORACLEµÄÐèÇó£¬Ó¦ÓóÌÐòÒ²ÒªÏàÓ¦×öһЩÐ޸ġ£±¾ÈË×ܽá³öÒÔϼ¸µã×¢ÒâÊÂÏϣÍû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
1£® ×Ô¶¯Ôö³¤µÄÊý¾ÝÀàÐ ......
mysqlÓÅ»¯£º ÄÚ´æ±íºÍÁÙʱ±í
2009Äê02ÔÂ01ÈÕ ÐÇÆÚÈÕ 10:41
ÓÉÓÚÖ±½ÓʹÓÃÁÙʱ±íÀ´´´½¨Öмä±í£¬ÆäËٶȲ»ÈçÈËÒ⣬Òò¶ø¾ÍÓÐÁË°ÑÁÙʱ±í½¨³ÉÄÚ´æ±íµÄÏë·¨¡£µ«ÄÚ´æ±íºÍÁÙʱ±íµÄÇø±ðÇÒ²¢²»ÊìϤ£¬ÐèÒª²éÕÒ×ÊÁÏÁË¡£
Ò»¿ªÊ¼ÒÔΪÁÙʱ±íÊÇ´´½¨ºó´æÔÚ£¬µ±Á¬½Ó¶Ï¿ªÊ±ÁÙʱ±í¾Í»á±»É¾³ý£¬¼´ÁÙʱ±íÊÇ´æÔÚÓÚ´ÅÅÌÉϵġ£¶øʵ¼Ê²Ù×÷Öз¢ÏÖÁÙÊ ......
ÔÚÊý¾Ý¿â±íÖУ¬¶Ô×ֶν¨Á¢Ë÷Òý¿ÉÒÔ´ó´óÌá¸ß²éѯËٶȡ£¼ÙÈçÎÒÃÇ´´½¨ÁËÒ»¸ö mytable±í£º
CREATE TABLE mytable(
ID INT NOT NULL,
username VARCHAR(16) NOT NULL
);
ÎÒÃÇËæ»úÏòÀïÃæ²åÈëÁË10000Ìõ¼Ç¼£¬ÆäÖÐÓÐÒ»Ìõ£º5555, admin¡£
ÔÚ²éÕÒusername="admin"µÄ¼Ç¼ SELECT * from mytable WHERE username='admin';ʱ£¬Èç¹ ......
ÒÔmysql-noinstall-5.1.6(win32)ΪÀý
1>°ÑѹËõÎļþmysql-noinstall-5.1.6-alpha-win32.zip½âѹµ½Ò»¸öĿ¼Ï£¬ÔÚ»·¾³±äÁ¿ÖÐÉèÖÃMYSQL_HOME£¬°Ñ%MYSQL_HOME%\bin ¼Ó
Èëµ½ path¡£
2>´´½¨my.iniÅäÖÃÎļþ,ÄÚÈÝÈçÏ£º
[mysqld]
#ÉèÖÃbasedirÖ¸ÏòmysqlµÄ°²×°Â·¾¶
basedir=...\mysql
datadir=...\mysql\data
my.iniÎ ......