First, prepare the compilation environment,Install required dependencies
yum groupinstall "development" -y
yum install openssl openssl-devel zlib zlib-devel -y
yum install readline-devel pcre-devel ncurses-devel bison-devel cmake -y
Compile and install
1. Use cmake to compile, cmake compiles in a different way than make, as follows:
make:
./configure
./configure --help
cmake:
cmake.
cmake .-lh or ccmake.
2.Compile options
Commonly used options for specifying the installation path
-dcmake_install_prefix =/usr/local/mysql
-dmysql_datadir =/data/mysql
-dsysconfdir =/etc
Storage engine configuration:
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_federated_storage_engine=1
To explicitly specify that an engine is not compiled,You can use a command similar to the following:
-dwithout_<engine>_storage_engine=1
To compile other functions,Such as ssl, you can use the following options to achieve a certain function or not used during compilation:
-dwith_readline=1
-dwith_ssl=system
-dwith_zlib=system
-dwith_libwrap=0
Other common options:
-dmysql_tcp_port=3306
-dmysql_unix_addr =/tmp/mysql.sock
-denabled_local_infile=1
-dextra_charsets=all
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci
-dwith_debug=0
-denable_profiling=1
Specific compilation options can refer to the official documentation
To clean up the generated files, use the make clean command
After compiling, you can make&&make install
Third, configure mysql
1. Provide an account for mysql,Run processes in a secure way,Modify the mysql installation directory owner group
useradd -r -s/sbin/nologin -m mysql
chown -r mysql:mysql/usr/local/mysql /
2, initialize mysql
mysql_ $home/scripts/mysql_install_db --user=mysql --basedir =/usr/locla/mysql --datadir =/usr/local/mysql/data
3.Provide the main configuration file for mysql
cp support-files/my-default.cnf /etc/my.cnf
4.Provide sysv service script for mysql and add it to the service startup list
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysqld
5, add the mysql man manual to the man search path,Modify /etc/man.conf to add
manpan/usr/local/mysql/man
6, output the mysql header file to the system header file path
ln -sv/usr/local/mysql/include//usr/include/mysql
7, output the mysql library file to the system search path,And let the system reload the system libraries
echo "/usr/local/mysql/lib">/etc/ld.so.conf.d/mysql.conf
ldconfig
8, modify the environment variables to add mysql, edit/etc/profile to add the path, and reload
export path="$path:/usr/local/mysql/bin"
source/etc/profile
9. At this point, the installation is complete.Start mysql
service mysqld start
The above is the rhel6.5 compilation and installation mysql5.6.26 tutorial that we share with you, I hope everyone likes it.
Related articles
- MySQL56 installation and configuration method graphic tutorial
- MySQL56 master-slave replication synchronization detailed configuration (graphics)
- MySQL56 cluster configuration method full version under Redhat 65
- MySQL56 Replication master-slave replication
- MySQL56 installation diagram (windows7/8_64 bit)
- Why can't I use an index in a subquery under mysql5619
- MySQL 5714 simple installation and configuration tutorial
- MySQL 5714 installation and configuration method graphic detailed tutorial
- MySQL 5714 installation and configuration method graphic tutorial
- Mysql 5617 installation graphic tutorial detailed version under Linux