Sample Header Ad - 728x90

Can I copy installed mysql from ubuntu to centos7 directly without installation?

0 votes
1 answer
305 views
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: 1. create user/group MySQL on Centos7 2. copying MySQL installed directory from ubuntu to the same directory on centos7, such as /usr/local/mysql 3. copying my.cnf file from Ubuntu to /etc on Centos7 4. copying mysql.server to /etc/init.d/mysql 5. grant permission to mysql.server and chown the owner of /usr/local/mysql to mysql:mysql 6. 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.
Asked by huangxy (1 rep)
May 19, 2021, 02:01 AM
Last activity: May 8, 2025, 11:41 PM