Home > Database > Mysql Tutorial > mysql5.7 method to change user initial password_Mysql

mysql5.7 method to change user initial password_Mysql

微波
Release: 2017-06-28 15:46:15
Original
1643 people have browsed it

When the user installs the MySQL database for the first time, he always wants to change the initialization password of root. I do it too. I check it on Baidu every time. Here are some commonly used methods for operating the database. SQL and some Basic concepts, friends who need it can refer to it

When users install the MySQL database for the first time, they always want to change the initialization password of root. Me too, every time Baidu, the following mainly gives some common SQL and some basic conceptual things for operating databases.

Modify the user's initialization password:

SET PASSWORD = PASSWORD(‘your new password');
ALTER USER ‘root'@‘localhost' PASSWORD EXPIRE NEVER;
flush privileges;
Copy after login

Create a new user:

CREATE USER ‘username'@‘host' IDENTIFIED BY ‘password';
Copy after login

Grant permissions to users:

GRANT all privileges ON databasename.tablename TO ‘username'@‘host';
flush privileges;
Copy after login

Set and change passwords:

SET PASSWORD FOR ‘username'@‘host' = PASSWORD(‘password');
Copy after login

Revoke permissions:

REVOKE privilege ON databasename.tablename FROM ‘username'@‘host';
Copy after login

DeleteUser:

DROP USER ‘username'@‘host';
Copy after login

View user authorization:

SHOW grants for ‘username'@‘host';
Copy after login

Innodb engine provides ACID transaction support:

  • A (atomicity; Atomicity) means that a transaction is either fully executed or not executed;

  • C (Consistency; Consistency) means that the running of the transaction does not change the consistency of the data in the database;

  • I (Independence; Isolation) is also called isolation, Refers to a state where two or more transactions will not be executed alternately;

  • D (Durability) refers to the fact that after the transaction is successfully executed, the changes made will be persisted in the database and will not Rollback for no reason;

MYSQL Isolation Level:

mysql5.7 method to change user initial password_Mysql

Dirty read: Allows reading of uncommitted dirty data.

Non-repeatable reading: Some records are read at point T1. When these records are re-read at point T2, these records may have been changed or disappeared.
Phantom reading: solves the problem of non-repeated reading and ensures that in the same transaction, the results of query are the state at the beginning of the transaction.

MYSQL's locking mechanism:

The locking mechanism is that the database changes various shared resources when they are accessed concurrently in order to ensure the consistency of the database. A rule set by order.

  • Row-level locking

  • The granularity of lockingobject is very small and can easily cause deadlock, but the contention for locking resources The probability of using it is also minimal.

  • Page-level locking

  • is between row-level locking and table-level locking.

  • Table-level locking

Maximum granularity locking mechanism. Deadlock is less likely to occur, but resource competition is more likely to occur.

Table-level locking is mainly used in some non-transactional storage engines such as MyISAM, Memory, and CSV. Row-level locking is mainly used in Innodb and NDBCluster storage engines. Page-level locking is mainly used in BerkeleyDB.

The above is the detailed content of mysql5.7 method to change user initial password_Mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template