Home > Database > Mysql Tutorial > Linux下mysql新建账号及权限设置方法_MySQL

Linux下mysql新建账号及权限设置方法_MySQL

WBOY
Release: 2016-06-01 13:22:52
Original
1005 people have browsed it

bitsCN.com 1、权限赋予

说明:mysql部署在服务器A上,内网上主机B通过客户端工具连接服务器A以进行数据库操作,需要服务器A赋予主机B操作mysql的权限

1.1 在服务器A上进入mysql,假设在服务器A上mysql的账户是root:

mysql - u root -p

然后回车键入密码!

1.2 赋予主机B操作数据库的权限

mysql> grant usage on *.* to username@192.168.0.1 identified by 'password';

说明:赋予username@192.168.0.1 使用所有数据库的权限,在主机192.168.0.1上使用username账户登录,密码为:password

mysql> grant all privileges on newdb.* to username@192.168.0.1;

说明:赋予username@192.168.0.1 操作数据库newdb的最高权限,在主机192.168.0.1上使用username账户登录,无密码

举例:

mysql> grant all privileges on *.* to root@192.168.0.1 identified by '123456' ;

说明:赋予root@192.168.0.1 使用所有数据库的权限,在主机192.168.0.1上使用root账户登录,密码为:123456

2、移除账号

mysql> drop user root@192.168.0.1;

说明:移除账户root,这样,主机192.168.0.1就不再可以使用root用户操作服务器A上的数据库bitsCN.com

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