How to modify Linux, MySQL password

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
Here Insert Picture Description
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.
Here Insert Picture Description
Then the password database modify, save and exit.
Here Insert Picture Description
Then modify password succeeded, through a password entered into the database.
Here Insert Picture Description

Published 59 original articles · won praise 361 · views 20000 +

Guess you like

Origin blog.csdn.net/famur/article/details/105369186