Mysql-5.6.34 Installation from Source code, installationsource

Source: Internet
Author: User

Mysql-5.6.34 Installation from Source code, installationsource

Took me a while to suffer from the first successful souce code installation of mysql-5.6.34. Just put it here and share it with u.

 

Env.

OS: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Mysql: mysql-5.6.34

1. Install Cmake

[Root @ exadata1 cmake-3.7.1] # pwd
/Root/mysql_install/cmake-3.7.1
[Root @ exadata1 cmake-3.7.1] #./configure
.
.
.
-- Build files have been written to:/root/mysql_install/cmake-3.7.1
---------------------------------------------
CMake has bootstrapped. Now run gmake.


Gmake

Make install




2. System configuration

2.1 add user/group
Groupadd mysql
Useradd-g mysql

2.2 vi/etc/security/limits. conf
Mysql soft nproc 2047
Hard nproc 16384
Mysql soft nofile 1024
Mysql hard nofile 65536



3. CMake config.

3.1 make sure if the package ncurses has been installed.

[Root @ exadata1 mysql_install] # rpm-qa ncurses
Ncurses-5.5-24.20060715
Ncurses-5.5-24.20060715

3.2 unzip the Mysql package.
[Root @ exadata1 mysql-5.7.17] # tar-zxvf mysql-5.7.17.tar.gz
[Root @ exadata1 mysql-5.7.17] # pwd
/Root/mysql_install/mysql-5.7.17

3.3

Cmake.-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \
-DDEFAULT_CHARSET = utf8 \
-DDEFAULT_COLLATION = utf8_general_ci \
-DENABLED_LOCAL_INFILE = ON \
-DWITH_INNOBASE_STORAGE_ENGINE = 1 \
-DWITH_FEDERATED_STORAGE_ENGINE = 1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE = 1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1 \
-DWITH_PARTITION_STORAGE_ENGINE = 1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE = 1 \
-DCOMPILATION_COMMENT = 'jss for mysqltest '\
-DWITH_READLINE = ON \
-DSYSCONFDIR =/data/mysqldata/3306 \
-DMYSQL_UNIX_ADDR =/data/mysqldata/3306/mysql. sock


Make & make install


3.4 Trouble shooting and diagnosis.
1.
-- Cocould NOT find Git (missing: GIT_EXECUTABLE)

Install and configure git in Linux
Http://blog.csdn.net/huaishu/article/details/40891229
Tar-xzf git-2.1.3.tar.gz
Cd git-2.1.3
./Configure-prefix =/usr/local/git -- with-curl -- with-expat
Make & make install

Modify/etc/profile, add the git PATH to PATH, and execute source/etc/profile
GIT_HOME =/usr/local/git
PATH = $ PATH: $ GIT_HOME/bin: $ GIT_HOME/libexec/git-core
Export PATH GIT_HOME

[Root @ exadata1 git-2.1.3] #./etc/profile
[Root @ exadata1 git-2.1.3] # git -- version
Git version 2.1.3

2. this can be ignored.
CMake Warning:
Manually-specified variables were not used by the project:
WITH_READLINE
-- Build files have been written to:/root/mysql_install/mysql-5.6.34



4. tar a package that can be deployed to any other host with similar specifications and OS.
[Root @ exadata1 mysql-5.6.34] # tar zcvf mysql-5.6.34.tar.gz/usr/local/mysql/

Shocould be around 230 M.

[Root @ exadata1 mysql-5.6.34] # ls-lht
Total 230 M
-Rw-r -- 1 root 229 M Dec 23 mysql-5.6.34.tar.gz

5. create Mysql DB
5.1
[Root @ exadata1 mysql-5.6.34] # chown-R mysql. mysql/usr/local/mysql
5.2 make dir
[Root @ exadata1 ~] # Mkdir-p/data/mysqldata/3306/
[Root @ exadata1 ~] # Chown-R mysql. mysql/data

Bash-3.2 $ id
Uid = 101 (mysql) gid = 1006 (mysql) groups = 1006 (mysql)
Bash-3.2 $ mkdir-p/data/mysqldata/3306/data
Bash-3.2 $ mkdir-p/data/mysqldata/3306/tmp
Bash-3.2 $ mkdir-p/data/mysqldata/3306/binlog/mysql-bin
Mkdir-p/data/mysqldata/3306/share/english

5.3 Edit profile

Vi ~ /. Bash_profile

Export LANG = zh_CN.GB18030
PATH = $ PATH: $ HOME/bin:/usr/local/mysql/lib

5.4 prepare. cnf

Vi/data/mysqldata/3306/my. cnf
[Client]
Port = 3306
Socket =/data/mysqldata/3306/mysql. sock

# The MySQL Server
[Mysqld]
Port = 3306
User = mysql
Socket =/data/mysqldata/3306/mysql. sock
Pid-file =/data/mysqldata/3306/mysql. pid
Basedir =/usr/local/mysql
Datadir =/data/mysqldata/3306/data
Language =/data/mysqldata/3306/share/english
Tmpdir =/data/mysqldata/3306/tmp
Open_files_limit = 10240
Explicit_defaults_for_timestamp
SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES

# Buffer
Max_allowed_packet = 256 M
Max_heap_table_size = 256 M
Net_buffer_length = 8 k
Sort_buffer_size = 2 M
Join_buffer_size = 4 M
Read_buffer_size = 2 M
Read_rnd_buffer_size = 16 M

# Log
Log-bin =/data/mysqldata/3306/binlog/mysql-bin
Binlog_cache_size = 32 M
Max_binlog_cache_size = 512 M
Max_binlog_size = 512 M
Binlog_format = mixed
Log_output = FILE
Log-error = ../mysql-error.log
Slow_query_log = 1
Slow_query_log_file = ../slow_query.log
General_log = 0
General_log_file = ../general_query.log
Expire-logs-days = 14

# InnoDB
Innodb_data_file_path = ibdata1: 2048 M: autoextend
Innodb_log_file_size = 256 M
Innodb_log_files_in_group = 3
Innodb_buffer_pool_size = 1024 M

[Mysql]
No-auto-rehash
Prompt = (\ u @ \ h) [\ d]> \_
Default-character-set = gbk


5.4 init mysql DB as root
/Usr/local/mysql/scripts/mysql_install_db -- datadir =/data/mysqldata/3306/data -- basedir =/usr/local/mysql -- user = mysql

/Usr/local/mysql/scripts/mysql_install_db -- datadir =/data/mysqldata/3306/data -- basedir =/usr/local/mysql



5.5 startup DB as root
Mysqld_safe -- defaults-file =/data/mysqldata/3306/my. cnf &

Check status:
[Root @ exadata1 share] # lsof-I: 3306
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Mysqld 3779 mysql 14u IPv6 3365226829 TCP *: mysql (LISTEN)
[Root @ exadata1 share] # netstat-na | grep 3306
Tcp 0 0: 3306: * LISTEN
Unix 2 [ACC] stream listening 3365226830/data/mysqldata/3306/mysql. sock



15:39:14 0 [Warning] The syntax '-- language/-l' is deprecated and will be removed in a future release. Please use '-- lc-messages-dir 'instead.
15:39:14 32112 [ERROR] Can't find messagefile '/data/mysqldata/3306/share/english/errmsg. sys'

Need to copy errmsg. sys from the source package and edit my. cnf (add language parameter)
[Root @ exadata1 english] # cp/root/mysql_install/mysql-5.6.34/SQL/share/english/errmsg. sys/data/mysqldata/3306/share/english /.


5.6 shutdown DB as root (need mysql root password which is 'mysql123' in my case)
[Root @ exadata1 english] # mysqladmin-u root-p shutdown
Enter password:
161223 15:48:43 mysqld_safe mysqld from pid file/data/mysqldata/3306/mysql. pid ended
[1] + Done mysqld_safe -- defaults-file =/data/mysqldata/3306/my. cnf (wd:/data/mysqldata/3306/share/english)
(Wd now :~ /Mysql_install/mysql-5.6.34/SQL/share/english)


5.7 Add mysql into service so that it can be started when host is rebooted.
[Root @ exadata1 support-files] # cp/usr/local/mysql/support-files/mysql. server/etc/init. d/mysql
[Root @ exadata1 support-files] #

[Root @ exadata1 support-files] # service mysql status
MySQL running (3779) [OK]
[Root @ exadata1 support-files] # service mysql stop
Shutting down MySQL .. 161223 16:15:37 mysqld_safe mysqld from pid file/data/mysqldata/3306/mysql. pid ended
[OK]
[1] + Done mysqld_safe -- defaults-file =/data/mysqldata/3306/my. cnf (wd:/usr/local/mysql/share)
(Wd now:/usr/local/mysql/support-files)
[Root @ exadata1 support-files] # service mysql start
Starting MySQL... [OK]
[Root @ exadata1 support-files] # service mysql status
MySQL running (5183) [OK]
[Root @ exadata1 support-files] #


5.8 log into mysql as mysql OS user.
[Root @ exadata1 support-files] # su-mysql
-Bash-3.2 $
-Bash-3.2 $
-Bash-3.2 $ bash
Bash-3.2 $ cat. bash_profile
#. Bash_profile

# Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi

# User specific environment and startup programs

PATH = $ PATH: $ HOME/bin:/usr/local/mysql/lib

Export PATH

Bash-3.2 $ mysql-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 4
Server version: 5.6.34-log JSS for mysqltest

Copyright (c) 2000,201 6, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

(Root @ localhost) [(none)]>


Reference
Http://www.cnblogs.com/jyzhao/p/5516031.html
Http://www.cnblogs.com/Richardzhu/p/3220883.html

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.