1:进入DOS命令 输入cd C:\Program Files\MySQL\MySQL Server 5.5\bin
2:输入 mysql -h 192.168******* -u root -p 回车(注意 -p后面不要写密码 也不要写“;”)
Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。 C:\Users\pc>cd C:\Program Files\MySQL\MySQL Server 5.6\bin C:\Program Files\MySQL\MySQL Server 5.6\bin>mysql -h localhost -u root -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 21 Server version: 5.6.16 MySQL Community Server (GPL) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec) mysql> use mysql; Database changed mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | | help_category | | help_keyword | | help_relation | | help_topic | | innodb_index_stats | | innodb_table_stats | | ndb_binlog_index | | plugin | | proc | | procs_priv | | proxies_priv | | servers | | slave_master_info | | slave_relay_log_info | | slave_worker_info | | slow_log | | tables_priv | | time_zone | | time_zone_leap_second | | time_zone_name | | time_zone_transition | | time_zone_transition_type | | user | +---------------------------+ 28 rows in set (0.00 sec) mysql> select password from user where user='root'; +-------------------------------------------+ | password | +-------------------------------------------+ | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | +-------------------------------------------+ 3 rows in set (0.00 sec) mysql> update user set password=password('root') where user='root'; Query OK, 0 rows affected (0.00 sec) Rows matched: 3 Changed: 0 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql>\q;