Home > Database > Mysql Tutorial > MySQL用户添加

MySQL用户添加

WBOY
Release: 2016-06-07 15:03:23
Original
1636 people have browsed it

我的是Ubuntu-12.04。发现在MySQL中经常出现添加用户之后,要么只能本地登陆,要么只能远程登陆的蛋疼的情况。这里记录一下是如何操作的。 创建用户 CREATE USER 'username'@'%' IDENTIFIED BY 'password'; 如果想要让这个用户即可以本地登陆,也可以远程登

我的是Ubuntu-12.04。发现在MySQL中经常出现添加用户之后,要么只能本地登陆,要么只能远程登陆的蛋疼的情况。这里记录一下是如何操作的。

创建用户

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


如果想要让这个用户即可以本地登陆,也可以远程登陆。需要执行:

grant select,insert,update,delete on test.* to username@'localhost' identified by 'password';
Copy after login

注意是localhost。

然后再

flush privilages;
Copy after login

就可以让添加的用户username用密码password即可从本地也可以从远程登陆。

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