Installing mysql environment under linux

Keywords: Linux MySQL cmake RPM Apache

1. When installing apache, it has been checked that there is no mysql native to centos installed locally. If there is any, it must be uninstalled, or the port may be occupied

2. Prepare mysql installation package (note that when compiling, the compilation of mysql 5.5 and above is different from that of mysql 5.5 and below. 5.5 needs to be compiled with cake, but the cake system does not have 6.5, so you need to download it yourself)

3. Prepare to upload the installation package xftp (before uploading, I recursively delete the useless packages of apache after installation, which saves troubles)


4. Uninstall the original version 5.1

Rpm-qa | grep-i MySQL found that it has its own version of mysql 5.1 (it is too low and needs to be uninstalled. Now the mainstream companies are all at or above version 5.5: it mainly conflicts with 5.5 package)

    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. Start unpacking


#yum -y install ncurses-devel


  1. tar -zxvf cmake-   
  2. cd cmake-  
  3. ./bootstrap   
  4. gmake     
  5. gmake install     
  6. cd ..     
  7. cmake --help     
  8. cmake --version      
  9. cp -rf ./cmake- /usr/local/cmake        
  10. rm -rf ./cmake-     
  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 #Regardless of export path = $path: $home / bin: / usr / local / MySQL / bin: / usr / local / MySQL / Lib service mysqld start service mysqld stop



Reference resources:

Posted by Honor on Mon, 30 Mar 2020 11:37:11 -0700