---
title: "mysql授权 远程访问授权"
author: "JadeLuo"
date: "2015-01-22T10:01:06Z"
tags: []
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2015-02-01T14:17:37Z"
id: 2178348
url: "https://jadeluo.iteye.com/blog/2178348"
---

GRANT ALL PRIVILEGES ON \*.* TO 'root'@'%' IDENTIFIED BY WITH GRANT OPTION 

FLUSH PRIVILEGES 

 

[mysql授权 远程访问授权](http://blog.csdn.net/lgh1117/article/details/7817597)

 

mysql&gt; grant all privileges on lfchat.* to dbname@localhost identified by 'password';

Query OK, 0 rows affected (0.03 sec)

 

mysql&gt; flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

mysql&gt; 

 

认情况下Mysql只允许本地登录，所以需要修改配置文件将地址绑定给注释掉：

vim /etc/mysql/my.cnf

\# Instead of skip-networking the default is now to listen only on  
\# localhost which is more compatible and is not less secure.  
#bind-address           = 127.0.0.1  &lt;---注释掉这一行就可以远程登录了