Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install MySQL 5.5 using Source from non-root linux user?

Tags:

linux

mysql

I need a generic way to install MySQL 5.5 in almost any Linux OS from non-root User. Hence I thought to install MySQL from its source and install it where ever I need.

Is it really possible to install MySQL in non-root user home? Anybody have any idea for this? Please do share your expertise for the same.

Major constraint here is that, I need to install MySQL 5.5 from any non-root User in a Generic way And possibly for almost any Linux OS.

Any suggestion would be appreciated.

Thanks.

CONCLUSION I've tried with Ubuntu-11.10, finally I was able to install MySQL-5.5 from non-root user with the constraint that MySQL is not accessible from console/command prompt. As mysqld is up and running fine hence MySQL was easily accessible via any GUI tool which connects to MySQL via JDBC connectors. If you try to access mysql from command prompt using

mysql -u root -p

command it was giving segmentation fault problem. One more thing I tried for Fedora Linux also from Non-Root user, in that mysqld was failing and can't access mysql anyway :( .

like image 452
SmartSolution Avatar asked May 16 '12 10:05

SmartSolution


2 Answers

You should customize this three variables:

MYSQL_DATADIR
SYSCONFDIR
CMAKE_INSTALL_PREFIX

Example:

$ cd <mysql_src_dir>
$ cmake -i .
    Would you like to see advanced options? [No]:Yes
    Please wait while cmake processes CMakeLists.txt files....
    ...
    Variable Name: CMAKE_INSTALL_PREFIX
    Description: install prefix
    Current Value: /usr/local/mysql
    New Value (Enter to keep current value): /home/user/mysql
    ...
    Variable Name: MYSQL_DATADIR
    Description: default MySQL data directory
    Current Value: /usr/local/mysql/data
    New Value (Enter to keep current value): /home/user/mysql/data
    ...
    Variable Name: SYSCONFDIR
    Description: config directory (for my.cnf)
    Current Value: /usr/local/mysql/etc
    New Value (Enter to keep current value): /home/user/mysql/etc
$ make
$ make install

Instead of cmake -i . you can use cmake -D MYSQL_DATADIR=/home/user/mysql/data -D SYSCONFDIR=/home/user/mysql/etc -D CMAKE_INSTALL_PREFIX=/home/user/mysql .

like image 169
Ivan Kinash Avatar answered Oct 11 '22 04:10

Ivan Kinash


I imagine this should be possible but not necessarily easy to do. You would need to build from source and change the Makefile so that the install target points to the user's local directory; additionally, I would think that you'd need to mess around with other default configuration options in MySQL, which can also be changed from configuration files. In the end, you should be able to launch mysqld as long as you don't bind to any port below 1000 (which is the case anyway since MySQL runs by default on port 3306).

like image 44
Icarus Avatar answered Oct 11 '22 04:10

Icarus