Home > Database > Mysql Tutorial > body text

mysql 更改数据存放地址

WBOY
Release: 2016-06-07 15:40:20
Original
1152 people have browsed it

1、 关闭mysql 服务: service mysqld stop 2 、 转移mysql 数据目录 mv /var/lib/mysql/ /data/ 3 、编辑my.cnf vi /etc/my.cnf 修改其中的datadir 和socket到新的路径 [mysqld] datadir=/data/mysql socket=/data/mysql/mysql.sock 4 、修改sock mkdir -p

1、关闭mysql服务:

service mysqld stop

2、 转移mysql数据目录

mv /var/lib/mysql/ /data/

3、编辑my.cnf

vi /etc/my.cnf

修改其中的datadir和socket到新的路径

[mysqld] 
datadir=/data/mysql 
socket=/data/mysql/mysql.sock

4、修改sock

mkdir -p /var/lib/mysql

ln–s /data/mysql/mysql.sock /var/lib/mysql/mysql.sock

5、重启服务

service mysqld start

 

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