初始化密码
mysql5.7会生成一个初始化密码,而在之前的版本首次登陆不需要登录。
shell> cat /root/.mysql_secret
# Password set for user 'root@localhost' at 2015-04-22 22:13:23
?G5W&tz1z.cN
mysql -p'?G5W&tz1z.cN'
alter user 'root'@'localhost' identified by 'mysql';
不知道随机密码
mysqld_safe --skip-grant-tables &
另外mysql5.7的mysql.user表结构被修改
修改mysql.user方式修改密码
mysql >
mysql> update mysql.user set authentication_string=password('123qwe') where user='svoid' and Host = 'localhost';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings:
然后启动MYSQL 服务器
alter user 'root'@'localhost' identified by 'mysql';
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
就可以了