Home  >  Article  >  Database  >  How to add users in mysql5.7

How to add users in mysql5.7

王林
王林Original
2020-10-16 10:06:331985browse

Mysql5.7 method to add users: first log in to mysql; then execute the [CREATE USER 'test'@'localhost' IDENTIFIED BY '1234';] statement to add users.

How to add users in mysql5.7

Add user

(Recommended tutorial: mysql video tutorial)

Example: Create test User, the password is 1234

MySQL -u root -p 
CREATE USER 'test'@'localhost'  IDENTIFIED BY '1234'; #本地登录 
CREATE USER 'test'@'%'  IDENTIFIED BY '1234'; #远程登录 
quit 
mysql -u test -p #测试是否创建成功

Delete user

mysql -u root -p 
Delete FROM mysql.user Where User=”test” and Host=”localhost”; 
flush privileges; 
drop database testDB;

Delete account and permissions:

drop user 用户名@’%’; 
drop user 用户名@ localhost;

Related recommendations:mysql tutorial

The above is the detailed content of How to add users in mysql5.7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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