1, after installation with yum MySQL
2, the initial password in this document /var/log/mysqld.log
3, enter the command: grep 'temporary password' /var/log/mysqld.log, can directly obtain the password.
(Note: The password for all the characters after the colon!)
If you want to change the default password, you can follow the following operations.
Add the following in /etc/my.cnf in:
Add skip-grant-tables in [mysqld] down, then save and exit
and restart the mysql service
systemctl restart mysqld
mysql -u root directly into the database
into mysql database
second database mysql: mysql This is the core database, similar to sql server in the master table, the user is responsible for the database is stored, permission settings, keywords, and so you need mysql control and management information used.
** Note: ** If you do not enter at this time to change the password mysql library will get the following error.
Then the password database modify, save and exit.
Then modify password succeeded, through a password entered into the database.