Compile and install MySQL

Source: Internet
Author: User

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.

    1. CMake \

    2. -dcmake_install_prefix=/usr/local/mysql \

    3. -dmysql_unix_addr=/usr/local/mysql/mysql.sock \

    4. -ddefault_charset=utf8 \

    5. -DDEFAULT_COLLATION=UTF8_GENERAL_CI \

    6. -dwith_innobase_storage_engine=1 \

    7. -dwith_archive_storage_engine=1 \

    8. -dwith_blackhole_storage_engine=1 \

    9. -DMYSQL_DATADIR=/DATA/MYSQLDB \

    10. -dmysql_tcp_port=3306 \

    11. -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

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.