Once again installed MySQL, version is 5.5.45,5.5 above need to install cmake!
Installation process:
0. First check if there is a mariadb, then uninstall
1. Install the required software;2. Install the CMake; 3. tar.gz form installation MySQL;4. Configuration and startup;
0. First CENTOS7 already does not support MySQL, so the internal integration of MARIADB, and the installation of MySQL will and mariadb file conflicts, so you need to uninstall MARIADB, the following is the uninstall mariadb, install MySQL steps. (Mom Egg, didn't know before, I installed a whole day only to know this pit, fu*k)
Rpm-qa|grep mariadb
See a mariadb-5.5.44... and mariadb-libs-... 2 files, delete them.
Rpm-e mariadb-libs-5.5.44-1.el7_1.x86_64
There is an error, this time to force the deletion, with the--nodeps parameter
RPM-E--nodeps mariadb-libs-5.5.44-1.el7_1.x86_64
RPM-E--nodeps mariadb-5.5.44-1.el7_1.x86_64
Forcibly removed, the wood has, can be installed at ease.
Rpm-qa|grep mariadb
1. Install MySQL dependent service
MySQL installation dependent service under Centos:
Yum install-y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
Ubuntu under MySQL installation dependent service
2. Install CMake under CentOS
wget http://tar-zxvf cmake-3.4.0.tar.gz && cd cmake-3.4.0./&& make install
After extracting and running./configure, "Now run Gmake" appears
So Gmake
installation directory
Enter the CMake command and see a response.
The CMake is ready for installation!
3. Download and install mysql-5.5.45
First clean up the environment: (to prevent the previous related documents)
-rf/etc/my. mysql mysql
Add the MySQL user group again
MySQL #[add MySQL Group]
useradd-g mysql mysql #[add mysql user under MySQL Group]
OK, start downloading mysql5.5.45
wget http://mirrors.sohu.com/mysql/mysql-5.5/mysql-5.5.45.tar.gzmysql-5.5.45.tar.gz && CD mysq-5.5.45.tar.gz
Go to MySQL directory and compile with CMake
cmake-dcmake_install_prefix=/usr/local/MySQL -dmysql_unix_addr=/tmp/MySQL.sock-ddefault_charset=UTF8-ddefault_collation=Utf8_general_ci-dwith_extra_charsets:STRING=utf8,GBK-dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1 -dwith_memory_storage_engime=1 -dwith_readline=1 -denabled_local_infile=1 -dmysql_datadir=/var/MySQL/Data-dmysql_user=MySQL
See this screen, it means the compilation OK.
Then
Make && make install
change MySQL directory owning group and all groups chmod +w/usr/local/mysql chownmysql: mysql/usr/local/ mysql
Enter the Mysql/lib directory and see libmysqlclient.so.18 and libmysqlclient.so.20
4. Setting up the configuration file
Then copy the configuration file:
Ln-s/usr/local/MySQL# Soft connect CD support-files #里面有多个my-*.cnf,large,huge,small, Medium, different configurations are available for different machine CP my-large.cnf/etc/my. mysql-server/etc/init.d/mysqld
To modify a configuration file:
Vim/etc/my. =/usr/local/mysql=/usr/local/mysql/datalog-error =/usr/ local/mysql/mysql_error. Log PID-File =/usr/local/mysql/data/mysql. PID default-storage-engine=MySQL
Then complete MySQL initialization
/usr/local/mysql/scripts/--basedir=/usr/local/mysql--datadir=/var /MySQL/--user=MySQL
Add MySQL to boot
chmod +x/etc/init.d/mysqld
Vim/etc/init.d/mysqld
modifying paths
Basedir=/usr/local/mysql
Datadir=/var/mysql/data
Chkconfig--add mysqld
Chkconfig--level 345 mysqld on
Configuring environment variables for MySQL
Export path=/usr/local/mysql/bin:$PATH
Start MySQL
Service mysqld Start
Set Password
/usr/local/MySQL/scripts/mysql_secure_installation
Note that only my.cnf inside the datadir for/usr/local/mysql/data, the others are /var/mysql/data!
Finally done!
Installing mysql5.5.45 under Centos