方法二 使用mysqladmin,这是前面声明的一个特例。 mysqladmin -u root -p password mypasswd 如:D:\Mysql\bin>mysqladmin -u root -p password adminEnter password:(在此输入你原密码)
希望对你有帮助
修改当前登录用户的密码: (也就是修改自己的密码)
mysql>SET PASSWORD = PASSWORD('test')
Query OK, 0 rows affected (0.00 sec)
mysql>select host, user, password from mysql.user
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | |
| localhost | | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
+-----------+------+-------------------------------------------+
2 rows in set (0.00 sec)
要想更改已有账户的密码,使用UPDATE来设置Password列值:
shell>mysql -u root mysql
mysql>UPDATE user SET Password = PASSWORD('bagel')
->WHERE Host = '%' AND User = 'francis'
mysql>FLUSH PRIVILEGES
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)