Centos迁移MySql目录
本文最后更新于 1967 天前,其中的信息可能已经有所发展或是发生改变。

因为测试环境mysql是使用yum安装的,默认目录是在/var/lib/mysql下,而/var归属/盘 只有50G,空间满后mysql就GG了,网上迁移mysql的教程大多是转移目录,修改配置文件,这种方法会因为系统版本、mysql版本差异导致各种启动不了.

下面先避免这些问题,我直接用软链迁移

1.停止mysql(千万不要用kill)
service mysql status #先看mysql运行状态,如果运行进行stop
service mysql stop
ps -ef|grep mysqld  #查看进程是否完全停止,一定要等正常停止后再迁移,千万不要kill关闭mysql
2.迁移mysql目录,设置软连接

记得看一下迁移前的权限和迁移后的目录权限是否正确,如果权限不一致mysql也会启动不了

若不一致执行:chown -R mysql:mysql /data/mysql_data/mysql

mv /var/lib/mysql /data/mysql_data/

ln -s /data/mysql_data/mysql /var/lib/mysql #设置软连接
3.重新启动mysql
service mysql start
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇