标签:mysql
mysql5.7为了安全考虑,初始化后root密码随机生成,密码放在error日志里面.
分两步:
第一步获取error.log密码.
修改默认密码,
passwd=`grep ‘generated for root@localhost‘ $base_log/error.log|awk ‘{print $NF}‘` expect <<! spawn /app/mysql/servers/bin/mysql -uroot -p expect "*password*" send "${passwd}\r"; expect "*>" send "set password for ‘root‘@‘localhost‘=password(‘setpay@123‘);\r" #如果密码太简单可能修改失败 send "exit\r" expect eof !
本文出自 “梧桐” 博客,请务必保留此出处http://songhl.blog.51cto.com/1538319/1926506
标签:mysql
原文地址:http://songhl.blog.51cto.com/1538319/1926506