当前位置:首页 > 数据库 > Mysql

mysql命令模式修改mysqlroot密码笔记

  修改mysql密码过程如下

  百度搜索一文章看到使用

  格式:mysqladmin -u用户名 -p旧密码 password 新密码

  修改于时我下看操作

  enter password:

  welcome to the mysql monitor. commands end with ; or g.

  your mysql connection id is 10

  server version: 5.5.27-log mysql community server (gpl)

  copyright (c) 2000, 2011, 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> mysqladmin -u root password 我要设置的密码

  ->

  -> ;

  error 1064 (42000): you have an error in your sql syntax; check the manual that

  corresponds to your mysql server version for the right syntax to use near 'mysql

  admin -u root password 我要设置的密码' at line 1

  mysql> mysqladmin -u root -password 我要设置的密码

  -> ;

  error 1064 (42000): you have an error in your sql syntax; check the manual that

  corresponds to your mysql server version for the right syntax to use near 'mysql

  admin -u root -password 我要设置的密码' at line 1

  最后小编使用了 mysqladmin -u root -password 我要设置的密码 无法搞定,突然想到直接更新表即可。

  mysql> update mysql.user set password=password('我要设置的密码') where user ='root

  ';

  query ok, 3 rows affected (0.05 sec)

  rows matched: 3 changed: 3 warnings: 0

  mysql> flush privileges;

  query ok, 0 rows affected (0.01 sec)

  mysql>

  好了这样就搞定了哦,虽然过程不复杂也不简单。


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐