mysql远程登录并设置密码

来源:互联网 发布:cdn 云计算 编辑:程序博客网 时间:2024/05/01 13:10

设置密码为password进行远程登录

[root@localhost ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 88Server version: 5.6.29-76.2-log Percona Server (GPL), Release 76.2, Revision ddf26feCopyright (c) 2009-2016 Percona LLC and/or its affiliatesCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> grant all on *.* to root@'%' identified by 'password';              Query OK, 0 rows affected (0.00 sec)mysql> exit

通过user数据库修改用户密码

mysql>use user;mysql>UPDATE user SET password=PASSWORD('123456') WHERE user='root';mysql>FLUSH PRIVILEGES;
0 0
原创粉丝点击