Home >Database >Mysql Tutorial >如何修改mysql数据库文件的路径_MySQL

如何修改mysql数据库文件的路径_MySQL

WBOY
WBOYOriginal
2016-05-27 14:29:441052browse

bitsCN.com

在网上找了好多,没有确定哪个是最终的答案,由于网站在运行中,实在不敢轻易动手,怎么奈我是个菜鸟呢!先把找到的东西简单记录一下,回头再说!

 

还有一个:

首先在数据库里看一下数据库里当前数据文件的存放路径:

mysql> show variables like '%dir%';
+----------------------------+----------------------------+
| Variable_name | Value |
+----------------------------+----------------------------+
| basedir | / |
| character_sets_dir | /usr/share/mysql/charsets/ |
| datadir | /data/mysql/ |
| innodb_data_home_dir | |
| innodb_log_arch_dir | |
| innodb_log_group_home_dir | ./ |
| innodb_max_dirty_pages_pct | 90 |
| slave_load_tmpdir | /tmp/ |
| tmpdir | /tmp/ |
+----------------------------+----------------------------+

如果你觉得这个路径可以的话,就不用去修改了。如果觉得不满意的话,也可以修改。

1:service mysql stop

关闭数据库

2:vi /etc/rc.d/init.d/mysql

3: 把 datadir=/var/lib/mysql 这里改成你想要的。就OK了

4:service mysql start


如何改变MySQL数据文件路径

bitsCN.com
Statement:
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