MySQL5.6.36 compilation and installation
1. Prepare MySQL5.6.36 before installation
(1) Clone a template machine (using centos6), and make a snapshot after cloning
(2) IP 10.0.0.52 hostname db02
(3) iptables selinux
(4) download 5.6.36
(5) install dependency packages
Yum install-y ncurses-devel libaio-devel cmake
(6) install cmake
Yum install cmake-y
(7) create a user
Useradd-s / sbin/nologin-M mysql
Id mysql
Download and install MySQL
(0) create a software download directory:
Mkdir-p / server/tools
Cd / server/tools/
(1) download and upload to / server/tools
Https://www.mysql.com/downloads/
Community version of MySQL Community Server
5.6 5.6.3x 5.6.34 5.6.36 5.6.38
Release more than 6-12 versions
5.7 5.7.17 after
(2) decompression:
Cd / server/tools
Tar xf mysql-5.6.36.tar.gz
(3) installation:
Cd mysql-5.6.36
Cmake. -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36\
-DMYSQL_DATADIR=/application/mysql-5.6.36/data\
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock\
-DDEFAULT_CHARSET=utf8\
-DDEFAULT_COLLATION=utf8_general_ci\
-DWITH_EXTRA_CHARSETS=all\
-DWITH_INNOBASE_STORAGE_ENGINE=1\
-DWITH_FEDERATED_STORAGE_ENGINE=1\
-DWITH_BLACKHOLE_STORAGE_ENGINE=1\
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1\
-DWITH_ZLIB=bundled\
-DWITH_SSL=bundled\
-DENABLED_LOCAL_INFILE=1\
-DWITH_EMBEDDED_SERVER=1\
-DENABLE_DOWNLOADS=1\
-DWITH_DEBUG=0
Make & & make install
3. Configure and start
(1) make a soft connection:
Ln-s / application/mysql-5.6.36/ / application/mysql
(2) copy the configuration file to / etc:
Cp support-files/my*.cnf / etc/my.cnf
(3) initialize the database:
/ application/mysql/scripts/mysql_install_db-basedir=/application/mysql/-datadir=/application/mysql/data-user=mysql
(4) create key directories and set permissions:
Mkdir-p / application/mysql/tmp
Chown-R mysql.mysql / application/mysql/
(5) copy the startup script to / etc/init.d/mysqld
Cp support-files/mysql.server / etc/init.d/mysqld
(6) start the database
/ etc/init.d/mysqld start
Netstat-lntup | grep 330
(7) configure environment variables
Echo 'PATH=/application/mysql/bin/:$PATH' > > / etc/profile
Tail-1 / etc/profile
Source / etc/profile
Echo $PATH
Mysql
Select user,host,password from mysql.user