关于Mysql的配置项

本文会记录如何mysql中一些常见的配置,已经实际的使用。

如何安装:在zip版的mysql安装目录下:

(备份my-default.ini,重命名为my.ini,在bin目录下运行cmd: mysqld -install

使用net start mysql启动mysql服务。

【1】bind_address=127.0.0.1   设置绑定的IP

port=3306  设定监听端口

【2】LOG_BIN  是否记录日志

该开关打开后会记录修改密码的sql:

log_error=error.log
log_bin=logbin.log

【3】datadir

设置数据文件路径

【4】关于select * from A 和 select * from A where 1=2;

附上SQL代码,如果你只是想获取表结构 那么可以通过右边的语句获取而不是左边的,右边的会快很多很多。

【5】关于杀毒软件以及MYSQL的临时目录

如果你使用了杀毒软件,那么你可能会看到如下错误:

The requested operation cannot be performed on a file with a user-mapped section open

如何监控mysql使用的临时文件呢? 使用如下的软件:

以前的叫FileMon(http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx)

 后来微软将这个功能加入到了:Process Monitor中。http://technet.microsoft.com/en-us/sysinternals/bb896645

你可以添加过滤器来过滤想要查看的进程,可以看到使用了临时目录:c:\windows\temp (该目录不是固定 取决于具体运行用户操作系统)

PS:这些记录可以导出成CSV文件,那么你可以通过excel分析 或者数据更大情况 你可以使用access 来快速过滤你期望的进程(通过sql查询)。

如果将该目录加入白名单会不够安全,那么可以看下使用mysql的配置项目:

tmpdir=d:\   The directory used for temporary files and temporary tables. This variable can be set to a list of several paths that are used in round-robin fashion. Paths should be separated by colon characters (“:”) on Unix and semicolon characters (“;”) on Windows.

 You can set the slave’s temporary directory using the slave_load_tmpdir variable. In that case, the slave will not use the general tmpdir value and you can set tmpdir to a nonpermanent location.