Home > Database > Mysql Tutorial > mysql创建用户_MySQL

mysql创建用户_MySQL

WBOY
Release: 2016-06-01 13:50:37
Original
878 people have browsed it

bitsCN.com

GRANT ALL PRIVILEGES ON *.* TO username@'%' IDENTIFIED BY "password"
Copy after login

分配远程username所有库的访问权限。

 

任何数据库的任何表到用户username使用密码password。

1 GRANT ALL PRIVILEGES ON test_db.* TO user1@192.168.1.3 IDENTIFIED BY "password"<br>2 GRANT ALL PRIVILEGES ON test_db.* TO user2@192.168.1.% IDENTIFIED BY "password"<br>3 GRANT ALL PRIVILEGES ON test_db.* TO user3@192.168.1.0/10 IDENTIFIED BY "password"
Copy after login

很明显,第一句是分配用户user1只能在192.168.1.3上访问。第二句是在192.168.1网段内都能访问。第三句是ip  0-10  范围内的。

删除用户:

DELETE FROM user WHERE User="username" and Host="localhost";
Copy after login

 

最后别忘了这句.

FLUSH PRIVILEGES;
Copy after login





 

bitsCN.com
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