System centos7,mysql5.7
1, the first time after the installation of MySQL temporary password
>grep "Password"/var/log/mysqld.log
Shown below:
................. A temporary password is generated for [email protected]: i8ulno2zrc+a
"I8ulno2zrc+a" This sentence is just installed after the temporary password, the first login must change the password
2, the first time to login to change the password
Alter user ' root ' @ ' localhost ' identified by ' new password ';
1. Forget the password you changed
>vim/etc/my.cnf
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
Skip-grant-tables-----> Add content ' Skip authorization check '
2. Restart MySQL Service
>systemctl Stop Mysqld.service
>systemctl Start Mysqld.service
3. Enter MySQL
>mysql
mysql> Update user Set Authentication_string=password (' 123456 ') where user= ' root ';
1. Remote Link permissions
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' your password ';
MySQL Change password, remote permissions