Home > Database > Mysql Tutorial > 更改MySQL数据文件目录位置_MySQL

更改MySQL数据文件目录位置_MySQL

WBOY
Release: 2016-06-01 13:41:39
Original
1096 people have browsed it

bitsCN.com
更改MySQL数据文件目录位置 有时候我们需要更改mysql数据文件的所在位置,下面以yum安装的mysql为例,把默认的data目录/var/lib/mysql更改为/home/mysql。 1、停止mysqld service mysqld stop
 2、修改my.cnf在[mysqld]中,把datadir=/var/lib/mysql更改为datadir=/home/mysql,把socket=/var/lib/mysql.sock更改为socket=/home/mysql/mysql.sock,最终修改如下:   [mysqld]datadir=/var/lib/mysql datadir=/home/mysqlsocket=/var/lib/mysql.sock socket=/home/mysql/mysql.sock在[mysql]中添加socket路径: socket=/home/mysql/mysql.sock
 3、移动data目录 mv /var/lib/mysql  /home
 4、修改启动文件/etc/init.d/mysqld把get_mysql_option mysqld datadir “/var/lib/mysql”更改为get_mysql_option mysqld datadir “/home/mysql”。  本文来自于CentOS Linux教程网 bitsCN.com

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