Mysql5.7 how to change the user's initial password, mysql5.7 initial password
When a user installs the MySQL database for the first time, he always wants to change the root initialization password. I am also trying to change the password every time. Below are some common SQL statements and some basic concepts for operating the database.
Modify the user's initialization password:
SET PASSWORD = PASSWORD(‘your new password');ALTER USER ‘root'@‘localhost' PASSWORD EXPIRE NEVER;flush privileges;
Create a new user:
CREATE USER ‘username'@‘host' IDENTIFIED BY ‘password';
Grant permissions to users:
GRANT all privileges ON databasename.tablename TO ‘username'@‘host';flush privileges;
Set and change the password:
SET PASSWORD FOR ‘username'@‘host' = PASSWORD(‘password');
Revoke permissions:
REVOKE privilege ON databasename.tablename FROM ‘username'@‘host';
Delete A User:
DROP USER ‘username'@‘host';
View user authorization:
SHOW grants for ‘username'@‘host';
The Innodb Engine supports ACID transactions:
- A (Atomicity; Atomicity) indicates that A transaction is either fully executed or not executed;
- C (Consistency; Consistency) indicates that the transaction operation does not change the data Consistency in the database;
- I (independence; Isolation) is also called Isolation, which refers to the state in which two or more transactions are not executed alternately;
- D (persistence; Durability) means that changes made after a transaction is successfully executed will be permanently stored in the database and will not be rolled back for no reason;
MYSQL isolation level:
Dirty read: allows you to read uncommitted dirty data.
Repeatable reading: some records are read at T1. when you reread these records at T2. these records may have been changed or disappeared.
Phantom read: solves the problem of non-repeated read, and ensures that the query results in the same transaction are in the state at the beginning of the transaction.
MYSQL locking mechanism:
The locking mechanism is a rule set by the database to keep various shared resources in order to ensure Database Consistency.
- Row-Level Lock
- The granularity of the locked object is small, which may lead to deadlocks, but the probability of resource contention locking is also minimal.
- Page-Level Lock
- Between row-level locking and table-level locking.
- Table-Level Lock
Maximum granularity locking mechanism. It is not prone to deadlocks, but there is a high probability of resource competition.
Table-level locking is mainly applied to non-transactional storage engines such as MyISAM, Memory, and CSV. Row-level locking is mainly applied to Innodb and NDBCluster storage engines. Page-level locking is mainly used for BerkeleyDB.
The above section describes how to modify the initial password of a user using mysql5.7. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!