如何对mysql进行数据迁移?
如何对mysql进行数据迁移?相信很多新手小白还没学会这个技能,通过这篇文章的总结,希望你能学会mysql数据迁移。如下资料是关于mysql数据迁移的步骤。
1停服务
/etc/init.d/mysqld stop
ls /var/lib/mysql/
2改配置
vi /etc/my.cnf
datadir=/data/mysql
3移数据
rsync -a /var/lib/mysql /data
hown -R mysql:mysql /data
4启动
/etc/init.d/mysqld start
#启动失败报错如下
200303 10:37:11 mysqld_safe Starting mysqld daemon with databases from /data/mysql
200303 10:37:11 [Warning] Can't create test file /data/mysql/logserver2.lower-test
200303 10:37:11 [Warning] Can't create test file /data/mysql/logserver2.lower-test
/usr/libexec/mysqld: Can't change dir to '/data/mysql/' (Errcode: 13)
200303 10:37:11 [ERROR] Aborting
200303 10:37:11 [Note] /usr/libexec/mysqld: Shutdown complete
200303 10:37:11 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
改selinux配置恢复正常
getenforce
setenforce 0
vi /etc/selinux/config
以上就是mysql数据迁移的步骤,详细使用情况还需要大家自己亲自动手使用过才能领会。如果想了解更多相关内容,欢迎关注行业资讯频道!