Talk about something new for a while, the official website downloaded the latest (mysql57-community-release-el6-7.noarch.rpm) to install Mysql5.7 through yum
run after download
#rpm -Uvh mysql57-community-release-el6-n
.noarch.rpm
update the repo, then
#yum install mysql-community-server
It works fine when installed.
After the installation is complete,
#service mysqld start Initializing the database is normal, but 5.7 has an additional validate_password plugin that will initialize a root password
need to use#grep 'temporary password' /var/log/mysqld.log方式去找到这个密码。
[root@iZ23e06nkpkZ home]# grep 'temporary password' /var/log/mysqld.log
2016-04-06T15:23:30.713906Z 1 [Note] A temporary password is generated for root@localhost: *RrWkwi072ta
The password is indeed out.
But here comes the problem, I can't get in with this password #mysql -uroot -p, it keeps reporting an error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
No way, the old way
#service mysqld stop stop mysqld first
execute, enter safe mode
[root@iZ23e06nkpkZ home]# mysqld_safe --skip-grant-tables &
Enter mysql -uroot -p
No password required
Entered into mysql>
mysql> use mysql;
mysql> update mysql.user set authentication_string=password('myNewPassword') where user='root';
Note here that in 5.6, the password field is now the authentication_string field.
mysql> flush privileges;
mysql> quit
Later
#service mysqld start
#mysql -uroot -p went in with the new password.
However, the operation seems to be incomplete at this time, and alter user...
alter user 'root'@'localhost' identified by '123';
The net article said that Jiangzi can also: set password for 'root'@'localhost'=password('123');