After mysql is compiled, it is automatically started.

Source: Internet
Author: User
II: compile and install mysql ################### install cmake ############### #### to compile and install mysql, you must use the cross-platform compiler cmake. [Root @ yong ~] # Yum-yinstallcmake ################### decompress mysql ############### # [root @ yong ~] #Tarxfmysql-5.5.33.tar. g

II: compile and install mysql ################### install cmake ############### #### to compile and install mysql, you must use the cross-platform compiler cmake. [Root @ yong ~] # Yum-y install cmake #################### decompress mysql ############# #### [root @ yong ~] # Tar xf mysql-5.5.33.tar.g

Ii. Compile, install, and configure mysql

################### Install cmake ###################
To compile and install mysql, you must use the cross-platform compiler cmake.
[Root @ yong ~] # Yum-y install cmake
################### Decompress mysql #################
[Root @ yong ~] # Tar xf mysql-5.5.33.tar.gz
################### Create a user who runs a program ############
[Root @ yong ~] # Groupadd-r mysql
[Root @ yong ~] # Useradd-g mysql-r mysql
################### Create a data storage directory ############
Suggestion: Use logical volumes to store data in real environments !!
[Root @ yong ~] # Mkdir-pv/mydata/data
[Root @ yong ~] # Chown-R mysql. mysql/mydata/data
################### Compile mysql ###################

For more information about compilation options, see http://www.linuxidc.com/Linux/2013-09/90349.htm.

[Root @ yong ~] # Cd mysql-5.5.33
[Root @ yong mysql-5.5.33] # cmake. -DCMAKE_INSTALL_PREFIX =/usr/local/mysql-DMYSQL_DATADIR =/mydata/data-DSYSCONFDIR =/etc-region = 1-region = 1-region = 1-DWITH_READLINE = 1-DWITH_SSL = system-DWITH_ZLIB = system-DWITH_LIBWRAP = 0-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci
#################### Install mysql ################
[Root @ yong mysql-5.5.33] # make & make install
#################### Change a group #################
[Root @ yong ~] # Cd/usr/local/mysql/
[Root @ yong mysql] # chown-R: mysql *
################### Initialize a database ##############
[Root @ yong mysql] # scripts/mysql_install_db -- user = mysql -- datadir =/mydata/data/
################### Create a configuration file ##############
[Root @ yong mysql] # cp support-files/my-large.cnf/etc/my. cnf
################### Edit the configuration file ##############
[Root @ yong mysql] # cd/etc/
[Root @ yong etc] # vim my. cnf
Datadir =/mydata/data # specify the location where mysql data files are stored
################### Create an execution script ##############
[Root @ yong mysql] # cp support-files/mysql. server/etc/rc. d/init. d/mysqld
[Root @ yong mysql] # chmod + x/etc/rc. d/init. d/mysqld # execution permission
################## Add a service ##################
[Root @ yong mysql] # chkconfig -- add mysqld
################# Start the service ###################
[Root @ yong mysql] # service mysqld start
################# Set environment variables ###############
[Root @ yong mysql] # vim/etc/profile. d/mysql. sh
Export PATH =/usr/local/mysql/bin: $ PATH # Add
[Root @ yong mysql] #./etc/profile. d/mysql. sh
############### Create a logon password ###############
[Root @ yong mysql] # mysqladmin-u root password mypass
[Root @ yong mysql] # mysql-uroot-pmypass
############## Specify access permissions ################
Mysql> grant all privileges on *. * to root @ '1970. 16. %. % 'identified by 'mypass ';
Mysql> flush privileges; re-read the authorization table

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.