通过show status 来优化MySQL数据库
2009年10月30日 星期五 22:53
1, 查看MySQL
服务器配置信息
mysql> show variables;
mysql> show variables;
2, 查看MySQL服务器运行的各种状态值
mysql> show global status;
mysql> show global status;
3, 慢查询
mysql> show variables like '%slow%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| log_slow_queries | OFF |
| slow_launch_time | 2 |
+------------------+-------+
mysql> show global status like '%slow%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| Slow_launch_threads | 0 |
| Slow_queries | 279 |
+---------------------+-------+
mysql> show variables like '%slow%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| log_slow_queries | OFF |
| slow_launch_time | 2 |
+------------------+-------+
mysql> show global status like '%slow%';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| Slow_launch_threads | 0 |
| Slow_queries | 279 |
+---------------------+-------+
配置中关闭了记录慢查询(最好是打开,方便优化
),超过2秒即为慢查询,一共有279条慢查询
4, 连接数
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 500 |
+-----------------+-------+
mys
相关文档:
GRANT ALL PRIVILEGES
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
Sql代码 复制代码
1. mysql -u root -pvmwaremysql>use mysql;
  ......
从mysql备份出来的sql文件进行还原操作时报错,查看错误日志,内容如下:
Error Code: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=50913 DEFAULT CHARSET=gbk' at li ......
前一篇文章中说到了LOAD命令,这里就来详细的给自己,顺便也给大家讲解下LOAD命令和批处理的数据导入功能。用的时候感觉MySQL用起来真的比较滋润。。。。
批处理导入文件,从sql文件导入数据到数据库中 ,批处理是一种非交互式运行mysql程序的方法, ......