Realize:
Yum installs the appropriate libraries because I have to install nginx,php on this machine, so the following libraries are installed
# yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel 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 e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
Download MySQL, compile and install
# wget http://dl.gaingreat.com/mysql-5.1.38.tar.gz# /usr/sbin/groupadd mysql# /usr/ sbin/useradd -s /sbin/nologin -m -g mysql mysql //add MySQL user to MySQL group, Specify SH as/sbin/nologin, no home directory # tar zxvf mysql-5.1.38.tar.gz# cd mysql-5.1.38/# ./ configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex -- enable-thread-safe-client --with-big-tables --with-readline --with-ssl -- With-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg# make && make install
# mkdir-p/opt/mysql/data# mkdir/var/log/mysql# Mkdir/usr/local/mysql/var//Set up this directory, or/etc/init.d/mysqld start will be an error, Because the Innodb_data_home_dir and Innodb_log_group_home_dir locations in the default my.cnf are/usr/local/mysql/var, you can modify the directory location or create a new directory # Chown-r mysql:mysql/usr/local/mysql# chown-r mysql:mysql/opt/mysql/data# chown-r mysql:mysql/var/log/mysql#/usr/local/ mysql/bin/mysql_install_db--basedir=/usr/local/mysql--datadir=/opt/mysql/data/--user=mysql//Here DataDir directory to be with below/ ETC/MY.CNF in the DataDir consistent, or will appear starting MySQL. Error manager of Pid-file quit without updating file. Specific reasons can be viewed by viewing the Mysql_error.log log
Copy config file to/etc/my.cnf
# cp-f/USR/LOCAL/MYSQL/SHARE/MYSQL/MY-MEDIUM.CNF/ETC/MY.CNF//convert skip-locking to skip-external-locking# sed-i ' s/ Skip-locking/skip-external-locking/g '/etc/my.cnf# sed-i ' s: #innodb: Innodb:g '/etc/my.cnf
Add Boot Boot
# cp/usr/local/mysql/share/mysql/mysql.server/etc/init.d/mysqld# chmod 755/etc/init.d/mysqld//Add Execute Permissions # ln-s/usr/ local/mysql/lib/mysql/usr/lib/# ln-s/usr/local/mysql/insclude/mysql/usr/include/# chkconfig mysqld on//Set boot up
Modify MY.CNF, add in [mysqld]
Log-error =/var/log/mysql/mysql_error.logpid-file =/var/log/mysql/mysql.piddatadir =/opt/mysql/data
Start MySQL
#/etc/init.d/mysqld Start
# /usr/local/mysql/bin/mysqladmin -u root password ' NewPassword ' # /usr/local/ mysql/bin/mysql -u root -p //log in to MySQL, delete the default account password > use mysql;> delete from user where not (user= ' root ') ;> delete from user where user= ' root ' and password= '; > drop database test;> drop USER '% '; //this one does not see the effect > flush privileges;
startup, shutdown of MySQL service
#/etc/init.d/mysqld start#/etc/init.d/mysqld Stop
This article is from the "villain" blog, please be sure to keep this source http://johnchow.blog.51cto.com/3517015/1639296
MySQL 5.1 compilation installation