admin 管理员组

文章数量: 887017

学Java,学到了JDBC,需要安装MySQL来练习。

访问MySQL官网,找到“DOWNLOADS” -> “MySQL Community (GPL) Downloads »” -> “MySQL Community Server”,然后选择系统和MySQL版本,最后点击“No thanks, just start my download.”,然后MySQL就会自动下载。这里我下载的是msi安装包。

安装过程不再赘述。

后来,需要修改MySQL配置文件,打开MySQL安装目录,并没有发现配置文件,隐藏文件也没有。

在命令行中输入

Shell

mysql --help

1mysql--help

在显示的帮助文档中有这样一条提示

Default options are read from the following files in the given order:

C:\Windows\my.ini C:\Windows\myf C:\my.ini C:\myf C:\Program Files\MySQL\MySQL Server 5.7\my.ini C:\Program Files\MySQL\MySQL Server 5.7\myf

1

2Defaultoptionsarereadfromthefollowingfilesinthegivenorder:

C:\Windows\my.iniC:\Windows\myfC:\my.iniC:\myfC:\ProgramFiles\MySQL\MySQLServer5.7\my.iniC:\ProgramFiles\MySQL\MySQLServer5.7\myf

找了对应位置,也没有。

登录MySQL,查询全局变量,查看MySQL数据文件存放位置

MySQL

mysql> show variables like "%char%";

+--------------------------+--------------------------------------------+

| Variable_name | Value |

+--------------------------+--------------------------------------------+

| character_set_client | utf8 |

| character_set_connection | utf8 |

| character_set_database | utf8 |

| character_set_filesystem | binary |

| character_set_results | utf8 |

| character_set_server | utf8 |

| character_set_system | utf8 |

| character_sets_dir | C:\ProgramData\MySQL\MySQL Server 5.7\Data |

+--------------------------+--------------------------------------------+

8 rows in set, 1 warning (0.01 sec)

1

2

3

4

5

6

7

8

9

10

11

12

13

14mysql>showvariableslike"%char%";

+--------------------------+--------------------------------------------+

|Variable_name|Value|

+--------------------------+--------------------------------------------+

|character_set_client|utf8|

|character_set_connection|utf8|

|character_set_database|utf8|

|character_set_filesystem|binary|

|character_set_results|utf8|

|character_set_server|utf8|

|character_set_system|utf8|

|character_sets_dir|C:\ProgramData\MySQL\MySQLServer5.7\Data|

+--------------------------+--------------------------------------------+

8rowsinset,1warning(0.01sec)

可以看到,MySQL的数据文件存放在“C:\ProgramData\MySQL\MySQL Server 5.7\Data”目录中。进入目录,终于在Date的上级目录找到了配置文件。my.ini配置文件

本文标签: 配置文件 系统 window MySQL ini