I'm trying to copy an installed MySQL from Ubuntu to Centos7 because I do not want an installation on Centos7 any more. This looks like it works but I'm not sure if there any potential issues which I do not know.
Has anyone tried this operation before?
The purpose to try this copying way is that I'm writing an one click installation sh script which including serveral softwares, such as JDK, MySQL, nginx, elasticsearch and some Java, python code. Coping existing MySQL is obviously the easiest way to finish MySQL installation script, since I need to install MySQL and create accounts and DB's in traditional way .
The steps for my copying MySQL directly from Ubuntu to Centos7 are:
- create user/group MySQL on Centos7
- copying MySQL installed directory from ubuntu to the same directory on centos7, such as
/usr/local/mysql
- copying
my.cnf
file from Ubuntu to/etc
on Centos7 - copying
mysql.server
to/etc/init.d/mysql
- grant permission to
mysql.server
andchown
the owner of/usr/local/mysql
tomysql:mysql
- start/stop MySQL service manually, it's looks fine
BTW, my Centos7 machine is new installed, which means I did not installed any other software on it, and my Centos7 can not reach internet so I could not install MySQL through apt
, yum
ways. I need to download installation package from website firstly, then I can install MySQL through rpm
, or tar
in the traditional way.
What I want to say is that no matter the apt
, yum
, rpm
, or tar
way, it's complicated to write these steps in my one click installation script, so I choose copying directly, but I have some worries about it since I do not know if there are some potential issues.