In CentOS6.6, the source code cmake compiles mysql 5.5

Source: Internet
Author: User

In CentOS6.6, the source code cmake compiles mysql 5.5

Preparations before MySQL compilation and Installation

Install the tools and libraries required for compiling source code

[Pure CentOS 6.6 i386]

yum install gccgcc-c++ncurses-develperlwgetreadline-develzlib-developenssl-devcmake

[CMAKE]

This option is often used to specify the installation path of the installation file:

-DCMAKE_INSTALL_PREFIX =/usr/local/mysql

-DMYSQL_DATADIR =/data/mysql

-DSYSCONFDIR =/etc

By default, the compiled storage engines include csv, myisam, myisammrg, and heap. To install other storage engines, you can use the following compilation options:

-DWITH_INNOBASE_STORAGE_ENGINE = 1

-DWITH_ARCHIVE_STORAGE_ENGINE = 1

-DWITH_BLACKHOLE_STORAGE_ENGINE = 1

-DWITH_FEDERATED_STORAGE_ENGINE = 1

To explicitly specify not to compile a storage engine, you can use the following options:

-DWITHOUT _ <ENGINE> _ STORAGE_ENGINE = 1

For example:

-DWITHOUT_EXAMPLE_STORAGE_ENGINE = 1

-DWITHOUT_FEDERATED_STORAGE_ENGINE = 1

-DWITHOUT_PARTITION_STORAGE_ENGINE = 1

If you want to compile it into other functions, such as SSL, you can use the following options to compile a database or not use a database:

-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

To clear the files generated by the previous compilation, run the following command:

Make clean

Rm CMakeCache.txt

2. Compile and install mysql

#tarxfmysql-5.5.33.tar.gz #cdmysql-5.5.33 #cmake.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\ -DMYSQL_DATADIR= /mydata/data/ \ -DSYSCONFDIR= /etc \ -DWITH_INNOBASE_STORAGE_ENGINE=1\ -DWITH_ARCHIVE_STPRAGE_ENGINE=1\ -DWITH_BLACKHOLE_STORAGE_ENGINE=1\ -DWIYH_READLINE=1\ -DWIYH_SSL=system\ -DVITH_ZLIB=system\ -DWITH_LOBWRAP=0\ -DMYSQL_UNIX_ADDR= /tmp/mysql .sock\ -DDEFAULT_CHARSET=utf8\ -DDEFAULT_COLLATION=utf8_general_ci #make #makeinstall #groupadd-r-g306mysql #useradd-gmysql-u306-r-s/sbin/nologinmysql Initialize mysql #cd/usr/local/mysql/ [root@localhostmysql] #mkdir-pv/mydata/data [root@localhostmysql] #chown:mysql-R./* [root@localhostmysql] #chown-Rmysql.mysql/mydata/data/ [root@localhostmysql] #ll/mydata/data/-d [root@localhostmysql] #scripts/mysql_install_db--user=mysql--datadir=/mydata/data/ [root@localhostmysql] #cpsupport-files/mysql.server/etc/rc.d/init.d/mysqld [root@localhostmysql] #chmod+x/etc/rc.d/init.d/mysqld [root@localhostmysql] #chkconfig--addmysqld [root@localhostmysql] #cpsupport-files/my-large.cnf/etc/my.cnf [root@localhostmysql] #vim/etc/my.cnf+40 datadir= /mydata/data Data Directory Thread_concurrency = 4 set the number of threads (number of cores x2) Insert and save. vim /etc/profile .d /mysql .sh export PATH= /usr/local/mysql/bin :$PATH [root@localhost~] #servicemysqldrestart [root@localhostmysql] #netstat-tnlp

Initialize mysql

Open a new shell and enable mysql [root@localhost~] #mysql mysql>usemysql; mysql>SELECTuser,host,passwordFROMuser; 1. Delete Anonymous Users mysql>DROPUSER '' @ 'localhost.localdomain' ; mysql>DROPUSER '' @ 'localhost' ; 2. Set a password for all root users: Method 1: mysql>SETPASSWORDFORusername@host=PASSWORD( 'your_passwrod' ); Method 2: mysql>UPDATEuserSETpassword=PASSWORD( 'your_password' )WHEREuser= 'root' ; mysql>FLUSHPRIVILEGES; Method 3: #mysqladmin-uUserName-hHostpassword'new_password'-p #mysqladmin-uUserName-hHost-pflush-privileges

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.