---
title: "mysql提供一个账户给外部访问"
author: "tomyjohn"
date: "2011-11-29T08:28:00Z"
tags: []
slug: "mysql"
draft: false
lastmod: "2012-08-11T17:50:35Z"
id: 1629201
url: "https://tomyjohn.iteye.com/blog/1629201"
---

//首先为用户创建一个数据库(phplampDB)  
mysql&gt;create database hitalking  
//授权hitalk用户拥有hitalking数据库的所有权限。  
&gt;grant all privileges on hitalking.* to hitalk@localhost identified by '1234';  
//刷新系统权限表  
mysql&gt;flush privileges;  
mysql&gt;其它操作  
localhost可以是IP地址'192.168.1.\*'  
/*  
如果想指定部分权限给一用户，可以这样来写:  
mysql&gt;grant select,update on hitalking.* to hitalk@localhost identified by '1234';  
//刷新系统权限表。  
mysql&gt;flush privileges;

grant all privileges on \*.* to 'yourname'@'%' identified by 'youpasswd';

转载于[http://mushme.iteye.com/blog/1013878](http://mushme.iteye.com/blog/1013878)