1)安装Mysql数据库
[root@nginx ~]# yum -y install ncurses-devel
安装配置工具cmake
[root@nginx ~]# tar xf cmake-2.8.12.tar.gz -C /usr/src/
[root@nginx ~]# cd /usr/src/cmake-2.8.12/
[root@nginx cmake-2.8.12]# ./configure && gmake && gmake install
[root@nginx ~]# tar xf mysql-5.7.2-m12.tar.gz -C /usr/src/
[root@nginx ~]# cd /usr/src/mysql-5.7.2-m12/
[root@nginx ]yum install ncurses-devel -y
[root@nginx mysql-5.7.2-m12]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc && make && make install
[root@nginx mysql-5.7.2-m12]# make && make install
2)优化调整
[root@nginx mysql-5.7.2-m12]# cp support-files/my-default.cnf /etc/my.cnf
[root@nginx mysql-5.7.2-m12]# cp support-files/mysql.server /etc/init.d/mysqld
[root@nginx mysql-5.7.2-m12]# chmod +x /etc/init.d/mysqld
[root@nginx mysql-5.7.2-m12]# chkconfig --add mysqld
[root@nginx mysql-5.7.2-m12]# chkconfig --list mysqld
mysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@nginx mysql-5.7.2-m12]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@nginx mysql-5.7.2-m12]# . /etc/profile
3)初始化数据库
[root@nginx mysql-5.7.2-m12]# groupadd mysql
[root@nginx mysql-5.7.2-m12]# useradd -M -s /sbin/nologin -g mysql mysql
[root@nginx mysql-5.7.2-m12]# chown -R mysql:mysql /usr/local/mysql/
[root@nginx mysql-5.7.2-m12]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --user=mysql
4)启动mysql服务
[root@nginx mysql-5.7.2-m12]# service mysqld start
Starting MySQL.............. [确定]
[root@nginx mysql-5.7.2-m12]# mysqladmin -u root password 'pwd123'
[root@nginx mysql-5.7.2-m12]# mysql -u root -ppwd123
[root@nginx ~]# yum -y install ncurses-devel
安装配置工具cmake
[root@nginx ~]# tar xf cmake-2.8.12.tar.gz -C /usr/src/
[root@nginx ~]# cd /usr/src/cmake-2.8.12/
[root@nginx cmake-2.8.12]# ./configure && gmake && gmake install
[root@nginx ~]# tar xf mysql-5.7.2-m12.tar.gz -C /usr/src/
[root@nginx ~]# cd /usr/src/mysql-5.7.2-m12/
[root@nginx ]yum install ncurses-devel -y
[root@nginx mysql-5.7.2-m12]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc && make && make install
[root@nginx mysql-5.7.2-m12]# make && make install
2)优化调整
[root@nginx mysql-5.7.2-m12]# cp support-files/my-default.cnf /etc/my.cnf
[root@nginx mysql-5.7.2-m12]# cp support-files/mysql.server /etc/init.d/mysqld
[root@nginx mysql-5.7.2-m12]# chmod +x /etc/init.d/mysqld
[root@nginx mysql-5.7.2-m12]# chkconfig --add mysqld
[root@nginx mysql-5.7.2-m12]# chkconfig --list mysqld
mysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@nginx mysql-5.7.2-m12]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@nginx mysql-5.7.2-m12]# . /etc/profile
3)初始化数据库
[root@nginx mysql-5.7.2-m12]# groupadd mysql
[root@nginx mysql-5.7.2-m12]# useradd -M -s /sbin/nologin -g mysql mysql
[root@nginx mysql-5.7.2-m12]# chown -R mysql:mysql /usr/local/mysql/
[root@nginx mysql-5.7.2-m12]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --user=mysql
4)启动mysql服务
[root@nginx mysql-5.7.2-m12]# service mysqld start
Starting MySQL.............. [确定]
[root@nginx mysql-5.7.2-m12]# mysqladmin -u root password 'pwd123'
[root@nginx mysql-5.7.2-m12]# mysql -u root -ppwd123
编辑回复