源码安装mysql

[root@mysqld ~]# yum install -y  gcc gcc-c++ autoconf libjpeg libjpeg-devel perl perl-CPAN libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2frogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers png jpeg autoconf  cmake make   ladp ldap* ncurses ncurses-devel zlib zlib-devel  pcre pcre-devel  openssl openssl-devel perl libtoolt openldap-devel libxml2-devel ntpdate cmake gd* gd2  jpeg jpeg* pcre-dev* fontconfig libpng libxml2 zip unzip gzip libtool zilib-devel

 上面的是为装mysql解决依赖包

[root@mysqld mysql]# useradd -s /sbin/nologin -M mysql

 

[root@mysqld mysql-5.5.40]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFALUT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306

 

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306

 

[root@mysqld mysql-5.5.40]# make && make install

 

[root@mysqld mysql-5.5.40]# cp -rf support-files/my-medium.cnf /etc/my.cnf 

 

 

[root@mysqld mysql-5.5.40]# cp -rf support-files/mysql.server /etc/init.d/mysqld

 

[root@mysqld mysql-5.5.40]# chmod 755 /etc/init.d/mysqld 
[root@mysqld mysql-5.5.40]# chmod +w /usr/local/mysql

 

[root@mysqld mysql-5.5.40]# chown -R mysql:mysql /usr/local/mysql

 

[root@mysqld mysql]# bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql

 

[root@mysqld mysql]# chkconfig mysqld on
[root@mysqld mysql]# chkconfig --list |grep mysqld
mysqld         	0:off	1:off	2:on	3:on	4:on	5:on	6:off

 

[root@mysqld mysql]# service mysqld start
Starting MySQL... SUCCESS!

 

posted @ 2016-05-20 11:31  bass  阅读(266)  评论(0编辑  收藏  举报