mysql5.7.17初始化登陆

mysql5.7.17初始化登陆

用户家目录下面有 .mysql_secret
or
/usr/local/mysql3306/localhost.localdomain.err 里面没有发现 A temporary password is generated for root@localhost

1 .mysql_secret

[root@localhost mysql3306]# cd –>进入root用户家目录
[root@localhost ~]# ll -a
total 68
dr-xr-x—. 2 root root 4096 Mar 28 11:56 .
dr-xr-xr-x. 24 root root 4096 Mar 28 2017 ..
-rw——-. 1 root root 956 Jan 16 2012 anaconda-ks.cfg
-rw——-. 1 root root 5193 Mar 27 13:31 .bash_history
-rw-r–r–. 1 root root 18 May 20 2009 .bash_logout
-rw-r–r–. 1 root root 176 May 20 2009 .bash_profile
-rw-r–r–. 1 root root 176 Sep 22 2004 .bashrc
-rw-r–r–. 1 root root 100 Sep 22 2004 .cshrc
-rw——-. 1 root root 78 Mar 27 12:14 .mysql_secret
-rw-r–r–. 1 root root 12148 Dec 16 2011 post-install
-rw-r–r–. 1 root root 552 Dec 16 2011 post-install.log
-rw-r–r–. 1 root root 129 Dec 3 2004 .tcshrc
-rw——-. 1 root root 5094 Mar 28 11:56 .viminfo
[root@localhost ~]# vim .mysql_secret

-# Password set for user ‘root@localhost’ at 2017-03-27 12:14:24
&0=qp.?wA%J;

2 tip: .mysql_secret 文件第二行全为密码 用单引号引起

–>登陆tip: &0=qp.?wA%J; 全部的字符都是密码 而且不用单引号引起来会报错。。。。
[root@localhost ~]# mysql -uroot -p’&0=qp.?wA%J;’ -P3306 -S /usr/local/mysql3306/mysql3306.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.17-log

Copyright (c) 2000, 2016, 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.

3 修改密码

mysql> alter user root@’%’ identified by ‘123456’;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user root@’localhost’ identified by ‘123456’;
Query OK, 0 rows affected (0.21 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.29 sec)

哈哈关于密码的更多,那就拿来主义:
http://www.cnblogs.com/Gbeniot/p/5156633.html 没有考究。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值