---
title: "【汇总】mysql常用操作【grant，show】"
author: "crizy"
date: "2011-10-10T11:00:08Z"
tags: ["MySQL"]
categories: ["数据库"]
slug: "mysql-grant-show"
draft: false
lastmod: "2011-09-08T16:59:24Z"
id: 1168621
url: "https://crizy.iteye.com/blog/1168621"
---

**1.创建拥有全部权限的账户**

```
mysql>grant all privileges on *.* to 用户名@'localhost' identified by '密码';
mysql>flush privileges;
```

推荐查看详细说明的链接：

[http://www.cnblogs.com/hcbin/archive/2010/04/23/1718379.html](http://www.cnblogs.com/hcbin/archive/2010/04/23/1718379.html)

 

 

**2.最大连接数，响应的最大连接数**

**（比较理想的设置：Max\_used\_connections / max\_connections * 100% ≈ 85%）**

```
// 最大连接数
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)

// 响应的最大连接数 
mysql> show global status like 'Max_used_connections';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Max_used_connections | 152   |
+----------------------+-------+
1 row in set (0.00 sec)
```

  

 

....