今天在服務器中安裝好了一個mysql服務器了,起初是配置好的mysql的root密碼了,但經過一些軟件的優(yōu)化之后把root密碼改成了空了,因為剛安裝好的環(huán)境沒有像mysql管理工具了,所以只有在命令模式下使用mysqladmin進行修改了,下面111cn站長為各位介紹一下mysql命令模式修改mysql root密碼方法。
修改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 --Vevb.com
- 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>
好了這樣就搞定了,雖然過程不復雜也不簡單.
新聞熱點
疑難解答
圖片精選