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.us
Ïà¹ØÎĵµ£º
ÎÒÃǵÄÏîÄ¿ÖÐÓкö಻µÈÓÚµÄÇé¿ö¡£½ñÌìдÕâƪÎÄÕ¼òµ¥µÄ·ÖÎöÒ»ÏÂÔõô¸öÓÅ»¯·¨¡£
ÕâÀïµÄ·Ö±íÂß¼ÊǸù¾Ýt_group±íµÄuser_name×éµÄ¸öÊýÀ´·ÖµÄ¡£
ÒòΪÕâÖÖÇé¿öµ¥¶Àuser_name×Ö¶ÎÉϵÄË÷Òý¾ÍÊôÓÚÀÃË÷Òý¡£Æð²»ÁËɶÃûÃ÷ÏÔµÄЧ¹û¡£
1¡¢ÊÔÑéPROCEDURE.
DELIMITER $$
DROP PROCEDURE `t_girl`.`sp_split_table`$$
CREATE PROCE ......
MYSQL ÐÞ¸ÄrootÃÜÂëÃüÁî
cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin
Ç°Ì᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
ÊäÈë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë update user set password=password('ÐÂÃÜÂë') where user='root';
»ØÏÔ
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
......
1¡¢È·¶¨Êý¾Ý¿âĬÈϱàÂ룬±ÈÈç±àÂëΪutf8,½«¶ÁÈë;¾¶±àÂëͬÑùÉèΪutf8£¬ÃüÁîΪ£ºset names utf8;
2¡¢source d:/20080613.sql µ¼ÈëÊý¾Ý¡£ÑéÖ¤Êý¾Ý¿âÖеÄÊý¾ÝÊÇ·ñ´æÔÚÂÒÂë¡£
3¡¢Èç¹ûÈÔÈ»´æÔÚÂÒÂëÎÊÌ⣬Õâʱºò¾ÍÒª¿¼ÂǸı䵼ÈëÎļþµÄ±à ......
¶Ômysql´æ´¢¹ý³ÌµÄ¼òµ¥Ó¦ÓÃ
Ïò±íÖвåÈëÄ£ÄâÊý¾Ý£¬¼ì²é·ÖҳЧ¹ûÊÇ·ñ³ö´í¡£
create procedure dowhile()
begin
declare cnt INT default 0;
while cnt<100 do
INSERT INTO `test`.`news` (`F_ID` ,`F_TITLE` ,`F_CLASSID` ,`F_ISUP` ,`F_CONTENT` ,`F_SOURCE` ,`F_DATETIME` ,`F_RE ......
1¡¢½âѹ mysql-noinstall-5.1.30-win32.zip
2¡¢ÔÚ F Å̽¨Á¢Ä¿Â¼ MySql\MySqlServer5.1\
3¡¢°Ñ½âѹµÄÄÚÈݸ´ÖƵ½ F:\MySql\MySqlServer5.1\
4¡¢ÔÚ F:\MySql\MySqlServer5.1\ ÖÐÕÒ my-large.ini °ÑËü¸´ÖÆ³É my.ini
5¡¢ÔÚ my.ini ÖÐÕÒ [mysqld] £¬Ìí¼ÓÒÔÏÂÓï¾ä;
basedir="F:/MySql/MySqlServer5.1/"
datadir="F:/My ......