linux下安装mysql环境

1.在安装apache的时候已经检查了本地没有安装centos自带的mysql,有的话一定要卸载掉,否则可能占用端口

2.准备mysql安装包(注意编译的时候,mysql5.5版本以上的编译和5.5一下的编译是不同的,5.5要用cake编译,但是cake系统6.5没有,需自己下载

3.准备安装包xftp上传(上传前我先递归删除了apache的安装后的无用包,省的碍事)

4.卸载原有的5.1版本

rpm -qa | grep -i mysql 发现有自带的mysql 5.1版本(太低了,需卸载,现在主流的公司都在5.5版本及以上:主要会和5.5package冲突

    whereis mysql  
    rpm -qa | grep -i mysql  
    service mysql stop  
    find / -name mysql  
    rm -rf /usr/lib64/mysql  
    rm -rf /usr/share/mysql/  
rpm -qa | grep -i mysql rpm -ev mysql-libs-5.1.73-3.el6_5.x86_64 --nodeps

6.开始解压包

http://blog.163.com/sz2273_pr/blog/static/41264296201361354426670/

#yum -y install ncurses-devel

 
 
  1. tar -zxvf cmake-2.8.10.2.tar.gz   
  2. cd cmake-2.8.10.2  
  3. ./bootstrap   
  4. gmake     
  5. gmake install     
  6. cd ..     
  7. cmake --help     
  8. cmake --version      
  9. cp -rf ./cmake-2.8.10.2 /usr/local/cmake        
  10. rm -rf ./cmake-2.8.10.2     
  11. ls     
  12. cmake --version         
  13. groupadd mysql     
  14. useradd -r -g mysql mysql  
  15. tar -zxvf mysql-5.5.30.tar.gz      
  16. cd mysql-5.5.30 

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/include/libxml2 --with-config-file-path=/usr/local/apache2/conf --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --enable-gd-native-ttf --with-zlib --with-mcrypt --with-pdo-mysql=/usr/local/mysql --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip --with-xmlrpc --enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif --enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-freetype-dir=/usr/lib/


make make install chown -R mysql.mysql /usr/local/mysql/ cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf cd /usr/local/mysql/ /usr/local/mysql/scripts/mysql_install_db --user=mysql cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig --level 345 mysqld on Vim /etc/profile #不用管export PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib service mysqld start service mysqld stop

参考:

https://blog.csdn.net/zhu_hua_jie/article/details/27077611

https://blog.csdn.net/along602/article/details/42695779

http://blog.163.com/sz2273_pr/blog/static/41264296201361354426670/

 

猜你喜欢

转载自www.cnblogs.com/yangzailu/p/8950384.html