Home > Database > Mysql Tutorial > 更改MYSQL数据data目录存放在地址

更改MYSQL数据data目录存放在地址

WBOY
Release: 2016-06-07 17:53:05
Original
1175 people have browsed it

MYSQL安装完毕之后,一般会默认在C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1目录下,如果服务器不小心被入侵了,你还不好还原系统,因为N多的网站数据都是放在这服务器上的。如果MYSQL不在C盘的话,这就好操作了。

以查看mysql文件目录my.ini文件,可以找到类似于
datadir="D:/beeagle/Program Files/MySQL/MySQL Server 5.0/Data/"的字段 该路径为mysql data目录
默认在:"C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\"

注意:Application Data文件夹是隐藏的!!!
可以修改上述配置,把Data文件夹放在你想放的地方。


---修改方式如下:

1.停止mysql,在命令窗口中输入并运行:net stop mysql  即可;

2.把"C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\" 里的Data文件夹剪切到目的地。本人把它放到了"D:\PHP\MySQL\MySQL Server 5.1"目录下(跟mysql放到了一起),并且把目录"C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\"删除掉。

3.修改my.ini文件,把datadir改成  datadir="D:\PHP\MySQL\MySQL Server 5.1\data\"

4.启动mysql,在命令窗口中输入并运行:net start mysql  即可;

5.修改完毕,以后就可以把相应的附加对象拷贝到里面来。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template