Pre-compilation
Yum install gcc gcc-c++ perl ncurses-devel
From mysql5.5 onwards, MySQL source installation started using CMake, set the source code compilation configuration script.
-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. |
-dwith_innobase_storage_engine=1 -dwith_archive_storage_engine=1 -dwith_blackhole_storage_engine=1 -dwith_perfschema_storage_engine=1 |
Storage Engine Options:
Myisam,merge,memory, and the CSV engine is compiled to the server by default and does not need to be explicitly installed.
Statically compiles a storage engine to the server, using-dwith_engine_storage_engine= 1
The available storage engine values are: ARCHIVE, Blackhole, EXAMPLE, Federated, Innobase (InnoDB), PARTITION (partitioning support), and Perfschema ( Performance Schema) |
-dmysql_datadir=dir_name |
Set the MySQL database file directory |
-dmysql_tcp_port=port_num |
Set the MySQL server listening port, default to 3306 |
-denable_downloads=bool |
Whether you want to download the optional files. For example, if you enable this option (set to 1), CMake will download the test suite that Google uses to run unit tests. |
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
Modify 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/mysqldbchown-r Mysql:mysql.
Initializing MySQL Database
Cd/usr/local/mysql scripts/mysql_install_db--user=mysql--datadir=/data/mysqldb
Copy the MySQL service startup configuration file
Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf
Note: Overwrite if the/etc/my.cnf file exists.
Search
Compile and install MySQL