mysql5.7.16 linux 下载_[centos]环境安装之mysql离线版压缩包(mysql-5.7.16-linux-glibc2.5-x86_64.tar)...

大致步骤如下

1.下载

2.检查系统有无mysql

3.创建 mysql用户

4.解压jar包

5.更改所有文件权限为mysql:mysql

6.复制配置文件到/etc/my.cnf并编辑

7.复制mysqld服务到/etc/init.d/mysqld

8.运行 ./bin/mysqld –initialize

9.启动服务(出现.pid文件错误用chown -R mysql:mysql /usr/local/mysql/data即可)

10.用mysqld –initialize 产生的密码登录mysql

11修改密码

具体为:

下载:https://dev.mysql.com/downloads/mysql/#downloads

rpm -qa |grep mysql

有则删除:yum remove pkg

创建用户

groupadd mysql

useradd -r -g mysql mysql

解压

tar xvf mysql-5.7.16-linux-glibc2.5-x86_64.tar

移动

mv mysql-5.7.16-linux-glibc2.5-x86_64 /usr/local/mysql/

然后进入目录

cd /usr/local/mysql

复制配置文件

cp support-files/my-default.cnf /etc/my.cnf

有覆盖提示输入:yes

编辑my.cnf文件

vi /etc/my.cnf

我的是:

# For advice on how to change settings please see

# https://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

# * DO NOT EDIT THIS FILE. It’s a template which will be copied to the

# * default location during install, and will be replaced if you

# * upgrade to a newer version of MySQL.

[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

# These are commonly set, remove the # and set as required.

basedir =/usr/local/mysql

datadir =/usr/local/mysql/data

# port = …..

# server_id = …..

# socket = …..

# 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 = 2M

然后把mysqld服务安装

cp support-files/mysql.server /etc/init.d/mysqld

数据库">然后初始化数据库

./bin/mysqld --initialize

这一步会产生一个随机密码(也可能会出错,很多种错误,我不列举,本来就是给自己看,如果你有问题欢迎截图来回复,我是失败了n次才成功,很多错误都见过)

如果初始化成功了,那么就开启服务吧

service mysqld start

这里可能会出现的错误有:

The server quit without updating PID file (/usr/local/mysql/data/snsgou.pid).

这个是因为权限不够吧!因为至始至终,mysql文件夹下的data文件夹都不是我们创建的,也就是自动创建的!

所以需要重新给下权限:

chown mysql:mysql /usr/local/mysql/data

接着在重启电脑(为了关闭mysqld进程..我不会kill -9 杀进程,老是杀错,还是重启实在),然后在重新 service mysqld start 试试!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值