您好,登录后才能下订单哦!
1).第一次设置root密码 (默认root密码为空)
1 | [root@mysql1 ~]# mysqladmin -uroot password '123456' |
2).修改root密码
1 | [root@mysql1 ~]# mysqladmin -uroot -p123456 password '123456789' |
1 | [root@mysql1 ~]# mysqladmin -uroot -p123456789 password 'hua19900822**' |
3).set password设置密码
1 2 3 4 5 | mysql> set password=password('123456'); #修改密码 Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges; #同步到磁盘上 Query OK, 0 rows affected (0.00 sec) |
4).update语句修改密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | mysql> use mysql; Database changed mysql> select user,host,password from user; +------+-----------+-------------------------------------------+ | user | host | password | +------+-----------+-------------------------------------------+ | root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | root | mysql1 | | | root | 127.0.0.1 | | | root | ::1 | | | | localhost | | | | mysql1 | | +------+-----------+-------------------------------------------+ 6 rows in set (0.00 sec)
mysql> update user set password=PASSWORD('789789') where user='root' and host='localhost'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) |
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。