MySQL5.6 compile and install

There are big differences in the compilation and installation of different versions of MySQL, MySQL 5.6 and 5.7 versions are introduced separately

  • The compilation and installation tutorial of MySQL5.7 is attached here:

                Compile and install MySQL5.7

One, MySQL5.6 compile and install

Install the database on the three MySQL nodes separately. Please use 5.6.36 for MySQL version and
2.8.6 for cmake version . The following is only a demonstration on Mysql1, the installation process is as follows.

  1. Install and compile dependent environment
[root@Mysql1 ~]# yum -y install ncurses-devel gcc-c++ perl-Module-Install
'//perl-Module-Install安装失败也没关系,太老了'
  1. Install gmake compilation software
[root@Mysql1 ~]# tar zxvf cmake-2.8.6.tar.gz
[root@Mysql1 ~]# cd cmake-2.8.6
[root@Mysql1 cmake-2.8.6]# ./configure
[root@Mysql1 cmake-2.8.6]# gmake && gmake install
  1. Install MySQL database
tar -zxvf mysql-5.6.36.tar.gz
cd mysql-5.6.36
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc
make && make install
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
groupadd mysql
useradd -M -s /sbin/nologin mysql -g mysql
chown -R mysql.mysql /usr/local/mysql
mkdir -p /data/mysql
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
  1. Installation is complete, set password
systemctl start mysqld
netstat -anpt | grep 3306
/usr/local/mysql/bin/mysqladmin -u root password 'abc123'
'//  abc123'为设置的密码'
  • The compilation and installation tutorial of MySQL5.7 is attached here:

                Compile and install MySQL5.7

Guess you like

Origin blog.csdn.net/qq_46480020/article/details/111925317