Home > Database > Mysql Tutorial > body text

为MySQL数据库添加新用户_MySQL

WBOY
Release: 2016-06-01 13:53:52
Original
873 people have browsed it

  刚安装完的MySQL中只有一个默认的用户,这就是root@localhost,如果需要使数据库被更多的用户访问使用,就需要添加新用户, 在windows可以用下面两种方法来添加:

  使用GRANT语句:

  grant select on test.* to 'yonghu'@'%' identified by 'some_pass' with grant option;

  例子表示增加一 个用户,名称是yonghu,来自任何位置,密码是some_pass可以对test数据库的任何表进行select命令。

  直接向grant表中插入用户:

  shell>mysql --user=root mysql

  mysql>insert into user (Host,User,Password) values('localhost','shagua','');

  mysql>flush privileges;表示将来自本机的用户,名叫shagua,密码为空,添加入数据库。

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