简体   繁体   English

如何从非root Linux用户使用Source安装MySQL 5.5?

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

I need a generic way to install MySQL 5.5 in almost any Linux OS from non-root User. 我需要一种通用的方法来在非root用户的几乎所有Linux操作系统中安装MySQL 5.5。 Hence I thought to install MySQL from its source and install it where ever I need. 因此,我想从其源代码安装MySQL并在需要的地方安装它。

Is it really possible to install MySQL in non-root user home? 真的可以在非root用户主目录中安装MySQL吗? 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. 这里的主要限制是,我需要以通用方式从任何非root用户安装MySQL 5.5,并且可能需要为几乎所有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. 结论我已经尝试使用Ubuntu-11.10,最后我能够从非root用户安装MySQL-5.5,并具有无法从控制台/命令提示符访问MySQL的约束。 As mysqld is up and running fine hence MySQL was easily accessible via any GUI tool which connects to MySQL via JDBC connectors. 由于mysqld正常运行,因此可以通过可通过JDBC连接器连接到MySQL的任何GUI工具轻松访问MySQL。 If you try to access mysql from command prompt using 如果您尝试使用以下命令从命令提示符访问mysql

mysql -u root -p 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 :( . 我也从非Root用户那里尝试过Fedora Linux的另一件事,因为mysqld失败了,无论如何也无法访问mysql :(。

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 . 代替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 . 您可以使用cmake -D MYSQL_DATADIR=/home/user/mysql/data -D SYSCONFDIR=/home/user/mysql/etc -D CMAKE_INSTALL_PREFIX=/home/user/mysql .

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; 您需要从源代码构建并更改Makefile,以使安装目标指向用户的本地目录。 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. 另外,我认为您需要弄乱MySQL中的其他默认配置选项,也可以从配置文件中更改这些默认配置选项。 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). 最后,只要不绑定到低于1000的任何端口,您就应该能够启动mysqld(无论如何,因为MySQL默认在端口3306上运行,所以确实如此)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM