Linux under mysql compilation Installation Tutorial
# View linux release number
Cat/etc/issue
# View linux kernel version
Uname-r
This paper tests environment centOS6.6
I,Linux under compile and install MySQL before the preparation work
Install the tools and libraries needed to compile the source online ( If you can't connect to the Internet, you need to prepare the software beforehand or the system disk )
Yum install gcc gcc-c++ ncurses-devel perl
Compiling from the mysql5.5 Origin code requires the help of the cmake compiler tool. Download the cmake source code from http://www.cmake.org and compile the installation.
wget http://www.cmake.org/files/v3.3/cmake-3.3.0.tar.gz
TAR-XZVF cmake-3.3.0.tar.gz
CD cmake-3.3.0
./bootstrap; make; Make install
CD ~
second, set up MySQL users and Groups
New MySQL user Group, new mysql user
Groupadd MySQL
Useradd-r-G MySQL MySQL
iii. directories required for new MySQL
Mkdir-p/usr/local/mysql
Mkdir-p/data/mysqldb
Download the MySQL source package and unzip it.
You can choose a mirror from http://dev.mysql.com/downloads/mirrors.html to download the source file, or you can download it directly online.
wget ftp://mirror.csclub.uwaterloo.ca/mysql/Downloads/MySQL-5.6/mysql-5.6.25.tar.gz
(The download source can be set by itself )
Tar-zxv-f mysql-5.6.25.tar.gz
CD mysql-5.6.25
v. Compile and install MySQL
From mysql5.5 onwards,mysql source installation started using cmake , set the source code compilation configuration script.
Go to the unpacked MySQL directory to execute .
cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/usr/local/mysql/mysql.sock-ddefault_charset= Utf8-ddefault_collation=utf8_general_ci-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_ Blackhole_storage_engine=1-dmysql_datadir=/data/mysqldb-dmysql_tcp_port=3306-denable_downloads=1
Note: To re-run the configuration, you need to delete the CMakeCache.txt file (rm CMakeCache.txt)
Then run the command
Make
Make instal
Introduction to Compilation Parameters:
-dcmake_install_prefix=dir_name setting up the MySQL installation directory
-dmysql_unix_addr=file_name set the listener socket path, which must be an absolute pathname. Default is /tmp/mysql.sock
-ddefault_charset=charset_name sets the character set of the server. By default,MySQL uses the latin1 (CP1252 Western European) character set. the cmake/character_sets.cmake file contains a list of allowed character set names.
-ddefault_collation=collation_name Sets the collation of the server.
The following are the storage engine options:
-dwith_innobase_storage_engine=1
-dwith_archive_storage_engine=1
-dwith_blackhole_storage_engine=1
-dwith_perfschema_storage_engine=1
MyISAM,MERGE,MEMORY, and CSV engines are compiled by default into the server and do not need to be explicitly installed. Statically compiles a storage engine to the server, using -dwith_engine_storage_engine= 1
Available storage engine values are:ARCHIVE, Blackhole, EXAMPLE, Federated, Innobase (InnoDB), PARTITION (partitioning support), and Perfschema (performance Schema)
-dmysql_datadir=dir_name setting up the mysql database file directory
-dmysql_tcp_port=port_num set mysql server listening port, default is 3306
-denable_downloads=bool if you want to download the optional file. For example, if you enable this option (set to 1),cmake will download the test suite that Google uses to run unit tests.
vi. modifying mysql directory owners and groups
Modifying the MySQL installation directory
Cd/usr/local/mysql
Chown-r Mysql:mysql.
Modifying the MySQL database file directory
Cd/data/mysqldb
Chown-r Mysql:mysql.
vii. initializing mysql database
Cd/usr/local/mysql
scripts/mysql_install_db--user=mysql--datadir=/data/mysqldb
viii. copy mysql service startup configuration file
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
ix. copy mysql service startup script and join path path
Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
Vim/etc/profile
Path=/usr/local/mysql/bin:/usr/local/mysql/lib: $PATH
Export PATH
Source/etc/profile
10, start the MySQL service and join the boot-up ( Optional This step, you can start it later )
Service MySQL Start
Chkconfig--level MySQL on
To see if MySQL is started
NETSTAT-TULNP | grep 3306
Mysql-u root-p
The first login password is empty, if you can log on, the installation is successful.
Set the user root password
mysqladmin-u root password ' 123456 '
Log in again to test
mysql-uroot-p123456
Reference Documents:
http://blog.csdn.net/wendi_0506/article/details/39478369
http://blog.csdn.net/hellozpc/article/details/47030415
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
MySQL compilation installation tutorial under Linux (CentOS)