易截截图软件、单文件、免安装、纯绿色、仅160KB

远程连接mysql速度慢的解决方法

远程连接mysql速度慢的解决方法
http://www.xishuiw.com
  PHP 远程连接MYSQL速度慢,有时远程连接到MYSQL用时4-20秒不等,本地连接MYSQL正常,出现这种问题的主要原因是,默认安装的MYSQL开启了DNS的反向解析,在MY.INI(WINDOWS系统下)或MY.CNF(UNIX或LINUX系统下)文件的[mysqld]下加入skip- name-resolve这一句。连接mysql速度慢的解决方法.
  2台服务器,一台跑iis+php,一台跑mysql,和以往一样配置好环境,测试页面一切OK
  跑应用的时候发现php访问mysql速度很慢,这种情况在以前从未发现过,虽然2台服务器并非在同一网段中,但是ping数值基本上都在1,2ms 之间,tcp连接应该不是问题关健,google以后找到答案,在my.ini文件的[mysqld]部分加入:skip-name-resolve,保存文件,重启mysql,一切OK啦,速度象飞一样了
  新版本的mysql配置起来不象以前的那个傻瓜化了,这个问题折腾了我一上午的时间,晚上回来总算是解决了,嘿嘿,又学到一些东西。
  Windows 2003下的MySQL 5服务器,本机连接到MySQL服务非常快,局域网内有两台Linux机器,有一台连接很快,另外一台输入密码后要等好几秒钟才能连上。
解决办法:
在MySQL服务器的配置中增加一个如下配置后速度飞快。
[mysqld]
skip-name-resolve
附录:( How MySQL uses DNS )
When a new thread connects to mysqld, mysqld will spawn a new thread to handle the request. This thread will first check if the hostname is in the hostname cache. If not the thread will call gethostbyaddr_r() and gethostbyname_r() to resolve the hostname.
If the operating system doesn't support the above thread-safe calls, the thread will lock a mutex and call gethostbyaddr() and gethostbyname() instead. Note that in this case no other thread can resolve other hostnames that is not in the hostname cache until the first thread is ready.
You can disable DNS host lookup by starting mysqld with --skip-name-resolve. In this case you can however only use IP names in the MySQL privilege tables.
If you have a very slow DNS and many hosts, you can get more performance by either disabling DNS lookop with --skip-name-resolve or by increasing the HOST_CACHE_SIZE define (default: 128) and recompile mysqld.
You can disable the h


相关文档:

安装mysql服务器,及修改1130错误

安装服务器端:下载一个mysql的安装程序,我安装的是5.0版本的,按照提示一步步操作完成。没有什么特别说明的。
安装客户端:下载一个mysql-query-browser,我用的是1.1版本的,安装,按照提示操作。
都安装完成以后,在本机用browser测试一下是否能连的上本机的服务,连接成功,都安装OK.
如果你想让其他的开发人员一起 ......

mysql存储过程简介

摘自http://blog.csdn.net/ljah/archive/2006/11/08/1373959.aspx
格式:
CREATE PROCEDURE 过程名 ([过程参数[,...]])
[特性 ...] 过程体
CREATE FUNCTION 函数名 ([函数参数[,...]])
RETURNS 返回类型
[特性 ...] 函数体
过程参数:
[ IN | OUT | INOUT ] 参数名 参数类型
函数参数:
参数名 参数类型
返回类型: ......

mysql 互为主从


grant replication slave on *.* to backup@192.168.188.128 identified by "123456"; 
grant replication slave on *.* to backup@192.168.188.8 identified by "123456"; 
service mysql stop
server_id = 1
log-bin = mysql-bin
log-error=mysql-error
master-host = 192.168.188.8
master-user = ba ......

MySQL学习2

  了解了一些最基本的操作命令后,我们再来学习如何创建一个数据库和数据库表。
1、使用SHOW语句找出在服务器上当前存在什么数据库:
mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| mysql   |
| test    |
+----------+
3 rows in set (0.00 sec) ......

mysql学习5

修改和备份、批处理
   有时我们要对数据库表和数据库进行修改和删除,可以用如下方法实现:
1、增加一列:
如在前面例子中的mytable表中增加一列表示是否单身single:
mysql> alter table mytable add column single char(1);
2、修改记录
将abccs的single记录修改为“y”:
mysql> ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号