Centos – How to install theSQL on CentOS without being root/su

centosMySQL

I want to install mySQL on CentOS.

I do not have a root account on that machine.

How can I install mySQL on CentOS as a user, ie. without being root?

Best Answer

For RPM packages (and CentOS is certainly a RPM system) you need to be root to run the rpm installer. The RPM installer needs to write to some package tracking dbs, and you need to be root to write to them. OK, well, mysql allows you to install from a tarball, right? (http://dev.mysql.com/doc/refman/5.0/en/binary-installation.html). Well, yeah, but there's a postinstall that you'll need to run, that you'll need to be root to do.

RPMs can have pre-and postinstall steps outside of just dumping out files. these can be changing configuration files, adding/deleting users. In general you may need to be root to do these. Even without scripts, you generally install into directories that only root can install to.

In another comment, you mention other packages that you've installed that you didn't need to be root. For these packages I'm sure that:

  • You installed from a tarball, not an RPM.
  • You installed into a non-system dir
  • The code was not tied to any specific dir (some code is compiled for specific paths)
  • There was no postinstall needed (no system config in /etc, no new users like MySQL needs)
Related Question