A very cool Thing:install MYSQL from source without root access on LINUX

Source: Internet
Author: User
Tags mysql download root access

Recently, due to the need for work, install the MySQL server on CentOS. As a soldier in the creeps, of course, there is no root authority, in order to be able to use MySQL, can only use the source installation (because binary installation method seems to require root access)

One, MySQL download

mysql.5.6.24

Second, decompression

Tar zxvf mysql.tar.gz

Third, the configuration

Refer to a lot of places, finally confused the configuration, the key is the location of the installation, the location of the database, the location of the configuration file three bar

CMake./-dcmake_install_prefix= $HOME/local/mysql \

-dmysql_datadir= $HOMElocal/mysql/data \

-dsysconfdir= $HOME/etc \

-dwith_myisam_storage_engine=1 \

-dwith_innobase_storage_engine=1 \

-dwith_memory_storage_engine=1 \

-dwith_readline=1 \

-dmysql_unix_addr= $HOME/local/tmp/mysqld.sock \

-dmysql_tcp_port=8812 \

-denabled_local_infile=1 \

-dwith_partition_storage_engine=1 \

-dextra_charsets=all \

-ddefault_charset=utf8 \

-ddefault_collation=utf8_general_ci

Four, installation

Make && make install

V. Installation of the database

This is actually just beginning to be a bit of a success, because MySQL has been looking for a default location, of course, there is no write permission, and finally in [1] got a very big inspiration.

In fact, in order to block out these default settings we just need to find a configuration file as input to these commands.

./scripts/mysql_install_db --defaults-file=~/my.cnf --user=martin --basedir=$HOME --datadir=/home/martin/sql_data --socket=/home/martin/socket

上面的参数value要具体改为我们自己的value

The my.cnf file above is very critical, we'd better test a successful installation after a certain directory below

# # The MySQL database server configuration file.## You can copy this to one of:#-'/etc/mysql/my.cnf ' to set global Optio ns,#-"~/.my.cnf" to set user-specific options.# # One can use all long options, the program supports.# Run program W ITH--help to get a list of available options and with#--print-defaults to see which it would actually understand and use . # # for explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html# This would be a passed to all MYSQ L clients# It had been reported that passwords should being enclosed with ticks/quotes# escpecially if they contain "#" chars ... # Remember to edit/etc/mysql/debian.cnf when changing the socket location. [Client]port = 3666socket =/home/guofeng/local/etc/mysql/mysqld.sock# Here's entries for some specific programs# the following values assume you had at least 32M ram# this was formally kno WN as [Safe_mysqld]. Both versions is currently parsed. [Mysqld_safe]socket =/home/guofeng/local/etc/mysql/mysqld.sockNice = 0[mysqld]## * Basic Settings#user =GuofengPid-file =/home/guofeng/local/etc/mysql/mysql.pidSocket =/home/guofeng/local/etc/mysql/mysqld.sockPort = 3666basedir =/home/guofeng/local/mysqlDataDir =/home/guofeng/local/etc/mysql/datadirTmpdir =/home/guofeng/local/etc/mysql/tmpLc-messages-dir =/home/guofeng/local/etc/mysql/skip-external-locking## Instead of skip-networking The default is now-listen only on# localhost which are more compatibl E and is isn't less secure.bind-address = 127.0.0.1## * Fine tuning#key_buffer = 16mmax_allowed_packet = 16 Mthread_stack = 192kthread_cache_size = 8# This replaces the startup script and checks MyISAM tables if Neede d# The first time they is touchedmyisam-recover = Backup#max_connections = 100#table_cache = 64 #thread_concurrency = 10## * Query Cache configuration#query_cache_limit = 1mquery_cache_size = 16m## * Logg  ing and replication## Both location gets rotated by the cronjob.# being aware that this log type is a performance killer.# as Of 5.1 can enable the log at runtime!general_log_file =/home/guofeng/local/etc/mysql/datadir/mysql.logGeneral_log = 1## Error log-should be very few entries. #log_error =/home/guofeng/local/etc/mysql/datadir/log.err## Here's can see queries with especially long duration#log_slow_queries =/VAR/LOG/MYSQL/MYSQL-SLOW.L Og#long_query_time = 2#log-queries-not-using-indexes## The following can be used as easy-replay backup logs or for REPL ication.# note:if You is setting up a replication slave, see README. Debian about# Other settings-need to change. #server-id = 1#log_bin =/var/log/mysql/mysql-     Bin.logexpire_logs_days = 10max_binlog_size = 100m#binlog_do_db = include_database_name#binlog_ignore_db = include_database_name## * innodb## InnoDB is enabled by default with a 10MB datafile in/var/lib/mysql/.# Read the M Anual for more InnoDB related options. There is many!## * Security features## Read The manual, too, if you want chroot!# chroot =/var/lib/mysql/## for Generati ng SSL certificates I recommend the OpenSSL GUI "Tinyca". # # ssl-ca=/etc/mysql/cacert.pem# ssl-cert=/etc/mysql/ server-cert.pem# ssl-key=/etc/mysql/server-key.peM[mysqldump]quickquote-namesmax_allowed_packet = 16m[mysql] #no-auto-rehash # faster start of MySQL but no tab comple Tition[isamchk]key_buffer = 16m## * important:additional settings that can override those from this file!# the F Iles must end with '. Cnf ', otherwise they ' ll be ignored.#

Six, start

./mysqld_safe--defaults-file=/home/guofeng/local/etc/mysql/my.cnf--skip-grant-tables&

Ps-ef | grep MySQL

Vii. access to the database

Mysql-u root-p

Enter a password at random

Go in and create a new user [2]

Create a user, authorize. SQL code create user Lzquan identified by ' 123456 '; Grant all privileges on * * to ' lzquan ' @ ' localhost ' identified by ' 123456 '; Flush privileges; SQL code Delete user, revoke permissions SQL code delete from Mysql.user where user= ' Lzquan ' and host= ' localhost '; Revoke all on testuser. * from ' Lzquan ' @localhost;

[1] Http://superuser.com/questions/209203/how-can-i-install-mysql-on-centos-without-being-root-su

[2] Http://blog.knowsky.com/223198.htm

A very cool Thing:install MYSQL from source without root access on LINUX

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.