分类: Mysql/postgreSQL
2017-02-03 18:09:32
环境介绍:
操作系统:CentOS Linux release 7.3.1611 (Core)
Mysql版本:mysql-community-server-5.7.17
准备工作:mysql rpm安装包以及依赖包
-rw-r--r-- 1 root root 30044 Feb 3 14:28 numactl-libs-2.0.9-6.el7_2.x86_64.rpm
-rw-r--r-- 1 root root 21708 Feb 3 14:21 libaio-0.3.107-10.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 169496800 Nov 30 00:31 mysql-community-server-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2237116 Nov 30 00:30 mysql-community-libs-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 277812 Nov 30 00:29 mysql-community-common-5.7.17-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 25037548 Nov 30 00:29 mysql-community-client-5.7.17-1.el7.x86_64.rpm
mysql5.7.17 rpm安装包下载地址为:
安装步骤:
1. 删除mariadb
# rpm -qa | grep mariadb | xargs -t -i rpm -e {} --nodeps
2. 添加用户组和用户
# group add mysql
# useradd -r -g mysql mysql
3. 安装依赖包
# rpm -ivh /usr/local/src/numactl-libs-2.0.9-6.el7_2.x86_64.rpm
# rpm -ivh /usr/local/src/libaio-0.3.107-10.el6.x86_64.rpm
4. 安装mysql-server
# rpm -ivh /usr/local/src/mysql-community-common-5.7.17-1.el7.x86_64.rpm
# rpm -ivh /usr/local/src/mysql-community-libs-5.7.17-1.el7.x86_64.rpm
# rpm -ivh /usr/local/src/mysql-community-client-5.7.17-1.el7.x86_64.rpm
# rpm -ivh /usr/local/src/mysql-community-server-5.7.17-1.el7.x86_64.rpm
5. 配置并启动mysql
# echo "user=mysql" >> /etc/my.cnf
# mysqld --initialize
# chown -R mysql:mysql /var/lib/mysql
# /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
6. 查看初始化产生的密码并连接mysql
# grep password /var/log/mysql.log
# mysql -uroot -p