Install mysql 5.6.12 (cmake compilation) in Linux Source Code 1. Install the make Compiler (which comes with the default system ): http://www.gnu.org/software/make/ [C-sharp] tar zxvf make-3.82.tar.gz cd make-3.82. /configure make install [c-sharp] tar zxvf make-3.82.tar.gz cd make-3.82. /configure make install 2. install bison (it is best to install all the base software before compiling LAMP ): http://www.gnu.org/software/bison/ [C-sharp] tar zxvf bison-2.5.tar.gz cd bison-2.5. /configure make install [c-sharp] tar zxvf bison-2.5.tar.gz cd bison-2.5. /configure make install 3. install gcc-c ++: http://www.gnu.org/software/gcc/ [C-sharp] tar zxvf gcc-c00000000-4.4.tar.gz cd gcc-c ++-4.4.4.4. /configure make install [c-sharp] tar zxvf gcc-c00000000-4.4.tar.gz cd gcc-c ++-4.4.4.4. /configure make install 4. install cmake (Please download the latest version for installation ): http://www.cmake.org/ [C-sharp] tar zxvf cmake-2.8.4.tar.gz cd cmake-2.8.4./configure make install [c-sharp] tar zxvf cmake-2.8.4.tar.gz cd cmake-2.8.4./configure make install 5. install ncurses: http://www.gnu.org/software/ncurses/ [C-sharp] tar zxvf ncurses-5.8.tar.gz cd ncurses-5.8./configure make install [c-sharp] tar zxvf ncurses-5.8.tar.gz cd ncurses-5.8./configure make install start to install MySQL ,: http://dev.mysql.com/ Here I download mysql-5.6.12.tar.gz ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/ Preparation [c-sharp] groupadd mysql useradd mysql-g mysql-M-s/sbin/nologin # Add a user named CentOS Mysql. -G: Specify the user group to which the new user belongs (group)-M: do not create the root directory-s: Define the shell it uses,/sbin/nologin indicates that the user cannot log on to the system. [C-sharp] groupadd mysql useradd-r-g mysql unzip and install MySQL [c-sharp] tar zxvf mysql-5.6.12.tar.gz cd mysql-5.6.12 (below is a line here for your understanding and comments written line feed comment, in actual compilation, add the "\" link before line breaks) cmake \-DCMAKE_INSTALL_PREFIX =/usr/local/mysql \ # installation path-DMYSQL_DATADIR =/usr/local/mysql/data \ # data file storage location-DSYSCONFDIR =/etc \ # my. cnf path-DWITH_MYISAM_STORAGE_ENGINE = 1 \ # support for MyIASM engine-DWITH_INNOBASE_STORAGE_ENGINE = 1 \ # support for InnoDB Engine-DWITH_MEMORY _ STORAGE_ENGINE = 1 \ # support for Memory engine-DWITH_READLINE = 1 \ # shortcut key function (I have never used it)-DMYSQL_UNIX_ADDR =/tmp/mysqld. sock \ # connect to the database socket path-DMYSQL_TCP_PORT = 3306 \ # port-DENABLED_LOCAL_INFILE = 1 \ # Allow local data import-DWITH_PARTITION_STORAGE_ENGINE = 1 \ # Install the database partition-DEXTRA_CHARSETS = all \ # install all character sets-DDEFAULT_CHARSET = utf8 \ # default character-DDEFAULT_COLLATION = utf8_general_ci make install, continue the following operation [c-sharp] cd/usr/local/mysql chown-R mysql: mys Ql. (After the installation is complete, modify the permission to the root user.) scripts/mysql_install_db -- user = mysql (perform the following permission modification first) chown-R root: mysql. (set the permission to the root user and the mysql group to cancel the read and write permissions of other users. Only the read and write permissions of mysql "rx" are granted. Other users do not have any permissions) chown-R mysql: mysql. /data (set the database directory to the mysql user mysql group, and grant the chmod-R ug + rwx read and write execution permission to the database. All other user permissions are deleted and only the mysql user permission is granted) [c-sharp] cd/usr/local/mysql chown-R mysql. chgrp-R mysql. scripts/mysql_install_db -- user = mysql chown-R root. the following command is: Optional. Copy the mysql configuration file to/etc [c-sharp] cp support-files/my-medium.cnf/etc/my. cnf (the original old version is this operation, 5.6.12 is the following file address) cp support-files/my-default.cnf/etc/my. cnf (and to/etc/my. the cnf + x permission deletes write permissions of other users at the same time, and only the root and workgroup rx permissions are granted. All other permissions are deleted even the rx permissions) [c-sharp] cp support-files/my-medium.cnf/etc/my. cnf # modify my. configure vim/etc/my. cnf # [mysqld] Add: datadir =/data/mysql default-storage-engine = MyISAM start mysql: [c-sharp] bin/mysqld_safe -- us Er = mysql & # Start mysql and check whether netstat-tnl is successful | grep 3306 [c-sharp] bin/mysqld_safe -- user = mysql & # Start mysql, check whether netstat-tnl | grep 3306 is successful. The preceding method is a simple and convenient method for starting mysql, as shown below: [c-sharp] # Add the mysql startup service to the System Service cp support-files/mysql. server/etc/init. d/mysql # Run the following command to start mysql service mysql start # stop mysql service mysql stop # restart mysql service mysql restart [c-sharp] # start mysql service add to System Service cp support-files/mysql. server /Etc/init. d/mysql. server # Now you can use the following command to start mysql service mysql. server start # Stop mysql service mysql. server stop # restart mysql service mysql. server restart: add the mysql service to the startup item, and enable the mysql service to start [c-sharp] chkconfig -- add mysql to change the default root account password, the default password is null. Change the password cd to the mysql directory cd/usr/local/mysql #. /bin/mysqladmin-u root password: Press enter and set the new password in the following prompt .. # Start MySQL/usr/local/mysql/bin/mysqld_safe-defaults-file =/etc/my. cnf & # or/etc/init. d/mysql start (service mysql start) # test whether MySQL is started #1) check whether there is a process mysql ps-ef | grep mysql #2) check whether the port is running netstat-tnl | grep 3306 #3) read mysql version information mysqladmin version