mysql命令模式修改mysql root密碼筆記

來源:互聯網
上載者:User

   修改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>

  好了這樣就搞定了哦,雖然過程不複雜也不簡單。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.