.¹Ø±ÕÏÖÓÐmysql
.²»¼ÓÔØgrant_tables¶ø½øÈëmysql
D:\>mysqld-nt --skip-grant-tables OR mysqld_safe --skip-grant-tables
.пªÒ»¸öcmd´°¿Ú,È»ºó°´ÏÂÃæÖ´ÐÐ
D:\>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.27-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
Database changed
mysql> select * from user;
Empty set (0.00 sec)
mysql> insert into user set user='root',ssl_cipher='',x509_issuer='',x509_subject='';
Query OK, 1 row affected, 3 warnings (0.00 sec)
(Õâʱ¿ÉÄÜ»áÌáʾij×Ö¶ÎÈçssl_cipherÎÞĬÈÏÖµ,¡¡Ö»Òª¼ÓÉÏ,ssl_cipher=''; Æä×Ö¶ÎÈçÓÐÌáʾÒÀ´ÎÌí¼Ó¾ÍOKÁË)
mysql> update user set Host='localhost',select_priv='y', insert_priv='y',update_priv='y',delete_priv='y',create_priv='y',drop_priv='y',reload_priv='y',shutdown_priv='y',Process_priv='y',file_priv='y',grant_priv='y',References_priv='y',index_priv='y',create_user_priv='y',show_db_priv='y',super_priv='y',create_tmp_table_priv='y',Lock_tables_priv='y',execute_priv='y',repl_slave_priv='y',repl_client_priv='y',create_view_priv='y',show_view_priv='y',create_routine_priv='y',alter_routine_priv='y',create_user_priv='y' where user='root';
mysql> quit
Bye
¹Ø±Õmysql
D:\> mysqladmin shutdown
2)´øÈ¨ÏÞÕý³£Æô¶¯mysql
D:\>mysqld-nt OR
3)пªÒ»¸öcmd´°¿Ú
D:\>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.27-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> update user set password=password('123456') where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
mysql> quit
ÊÔÏÂûÓÐÃÜÂëʱ½øÈëmysql
D:\>mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ʹÓÃÃÜÂë½øÈëmysql
D:\>mysql -u root -p123456
Welcome to the MySQL monito
µ±ÄãÁ¬½ÓÒ»¸öMySQL·þÎñÆ÷ʱ£¬Äãͨ³£Ó¦¸ÃʹÓÃÒ»¸ö¿ÚÁî¡£¿ÚÁî²»ÒÔÃ÷ÎÄÔÚÁ¬½ÓÉÏ´«Êä¡£
ËùÓÐÆäËûÐÅÏ¢×÷ΪÄܱ»ËùÓÐÈ˶Á¶®µÄÎı¾±»´«Êä¡£Èç¹ûÄãµ£ÐÄÕâ¸ö£¬Äã¿ÉʹÓÃѹËõÐÒé(MySQL3.22ºÍÒÔÉϰ汾)ʹÊÂÇé±äµÃ¸üÄÑ¡£ÉõÖÁΪÁËʹһÇиü°²È«£¬ÄãÓ¦¸Ã°²×°ssh£¨¼ûhttp://www.cs.hut.fi/ssh)¡£ÓÃËû£¬ÄãÄÜÔÚÒ»¸öMySQL·þÎñÆ÷ºÍÒ»¸öMySQL¿Í» ......
ΪÁËÈÃÓû§²»ÐèÒª×Ô¼ºÔËÐÐmysql°²×°³ÌÐò°²×°mysqlÊý¾Ý¿â£¬Èí¼þ·¢²¼Ê±ÐèÒª´ò°üÃâ°²×°°æ±¾µÄmysql¡£´Ómysql¹ÙÍøÉÏÖ±½ÓÏÂÔØµÄÃâ°²×°°æ±¾ÐèÒª¸÷ÖÖÅäÖã¬Èç¹ûÅäÖò»ºÃ£¬ºÜÈÝÒײúÉú¸÷ÖÖ¸÷ÑùµÄÎÊÌâ¡£ÓÈÆäÊÇ´íÎóÂëΪ1067µÄÎÊÌ⣬ÎÒÊÔÑéÁËÍøÉϵĺܶ෽·¨¶¼Ã»Æð×÷Óã¬×îºóÏëÁËÒ»¸ö×î¼òµ¥µÄ·½·¨£º
£¨1£©Ê×ÏÈʹÓð² ......