Centos6.8下安装MySQL5.7.17
来源:互联网 发布:windows应用商店的游戏 编辑:程序博客网 时间:2024/06/06 12:43
查看Centos版本
[root@slaver2 ~]# cat /etc/redhat-release CentOS release 6.8 (Final)
查看系统中是否已安装mysql,如果安装就卸载
##查看是否安装[root@slaver2 ~]# rpm -qa | grep mysqlmysql-libs-5.1.73-8.el6_8.x86_64##如果安装进行卸载[root@slaver2 ~]# rpm -e mysqlerror: package mysql is not installed[root@slaver2 ~]# rpm -e --nodeps mysqlerror: package mysql is not installed##如果没有安装,把包进行移除[root@slaver2 ~]# yum -y remove mysql-libs
下载MySQL数据库
我本地已经把mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar下载好了,没有的可以登录到官网进行下载。用WinScp软件上传到Centos服务器上。
##查看包中的文件[root@slaver2 mycloud]# tar -tf mysql-5.7.17-1.el6.x86_64.rpm-bundle.tarmysql-community-test-5.7.17-1.el6.x86_64.rpmmysql-community-embedded-5.7.17-1.el6.x86_64.rpmmysql-community-embedded-devel-5.7.17-1.el6.x86_64.rpmmysql-community-server-5.7.17-1.el6.x86_64.rpmmysql-community-libs-compat-5.7.17-1.el6.x86_64.rpmmysql-community-devel-5.7.17-1.el6.x86_64.rpmmysql-community-client-5.7.17-1.el6.x86_64.rpmmysql-community-libs-5.7.17-1.el6.x86_64.rpmmysql-community-common-5.7.17-1.el6.x86_64.rpm
##解压到Mysql文件夹下[root@slaver2 mycloud]# tar -xf mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar -C ./mysql
创建MySQL用户名和用户组
[root@slaver2 mysql]# groupadd -r mysql[root@slaver2 mysql]# useradd -r -g mysql -s /bin/false -M mysql
安装文件,应严格顺序进行安装
##安装依赖包rpm -ivh mysql-community-common-5.7.17-1.el6.x86_64.rpmrpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm##安装客户端rpm -ivh mysql-community-client-5.7.17-1.el6.x86_64.rpm##安装服务端rpm -ivh mysql-community-server-5.7.17-1.el6.x86_64.rpm
初始化mysql
mysql安装完成后,需要初始化root 用户获得初始密码
[root@slaver2 mysql]# mysqld --initialize --user=mysql
临时密码存在mysql.log内容下
[root@slaver2 mysql]# cat /var/log/mysqld.log |grep password2017-05-03T06:11:50.136597Z 1 [Note] A temporary password is generated for root@localhost: ie8su.rjFCp:
启动mysql服务
[root@slaver2 mysql]# /etc/init.d/mysqld statusmysqld is stopped[root@slaver2 mysql]# /etc/init.d/mysqld startStarting mysqld: [ OK ]
登录mysql,并修改密码
[root@slaver2 mysql]# mysql -uroot -pie8su.rjFCp:mysql> alter user 'root'@'localhost' identified by '123456';mysql> exitmysql> mysql -uroot -pEnter password:mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.00 sec)mysql>
设置MySQL开机自启动
##查看是否开启[root@slaver2 mysql]# chkconfig --list |grep mysqlmysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off##如果没开启,执行语句[root@slaver2 mysql]# chkconfig --level 345 mysqld on
到此处mysql已经安装完成,mysq配置文件my.cnf
具体配置信息
[root@slaver2 mysql]# cat /etc/my.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html[mysqld]## Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M## Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin## Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2Mdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid[root@slaver2 mysql]#
参考文章:http://blog.csdn.net/u012456926/article/details/50166287
0 0
- Centos6.8下安装MySQL5.7.17
- CentOs6.8 安装 mysql5.7.17
- CentOS6.5下安装MySql5.7.17
- CentOS6.8下源码安装mysql5.6.21
- centos6安装mysql5.7.17
- centos6.8 安装最新版mysql5.7.17
- Linux运维:CentOS6.8下安装MySql5.7
- 在CentOS6.8下rpm方式安装MySQL5.7
- 阿里云ECS-centos6.8下 安装配置mysql5.7
- centos6.8 安装mysql5.7
- centos6.8安装mysql5.6
- Centos6.8安装Mysql5.6
- Centos6.8 安装MySQL5.7
- centOS6.3下安装mysql5.6详解
- CentOS6.6下编译安装mysql5.6
- centos6.3下mysql5.5.32源码安装
- centos6.2 下安装mysql5.5
- centos6下通用二进制安装mysql5.5.33
- 一笔画问题 南阳 42题 dfs
- 鼠标悬浮图片放大
- 如何使用Android studio打开eclipse项目
- Q3DSurface 文档翻译
- [BZOJ 1912][Apio2010]patrol 巡逻:树的直径
- Centos6.8下安装MySQL5.7.17
- java服务器端接收json格式传递的参数
- 运维小白的python之路(五)——模块
- IBM Cognos Configuration 服务器配置
- 实践之数据竞赛的套路
- adapter适配器缓存
- 输出所有可能的全排列
- 虚析构函数
- 证书转换-SSL证书生成:cer,jks文件 韩俊强的博客