登录root用户用root用户登录控制台。
use mysqluse mysql,mysql是mysql数据库自动创建的一个数据库。
修改user表的数据update user set password=password('1234') where user='root';
刷新权限flush privileges;
参考修改mysql用户密码
附: 1、完整的命令行操作mysql> show databases;+--------------------+| database |+--------------------+| information_schema || mysql || ospm || performance_schema || test |+--------------------+5 rows in set (0.00 sec)mysql> use mysqldatabase changedmysql> show tables;+---------------------------+| tables_in_mysql |+---------------------------+| columns_priv || db || event || func || general_log || help_category || help_keyword || help_relation || help_topic || host || ndb_binlog_index || plugin || proc || procs_priv || proxies_priv || servers || slow_log || tables_priv || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition || time_zone_transition_type || user |+---------------------------+24 rows in set (0.00 sec)mysql> update user set password=password('1234') where user='root';query ok, 1 row affected (0.02 sec)rows matched: 1 changed: 1 warnings: 0mysql> flush privileges;query ok, 0 rows affected (0.00 sec)mysql>