美文网首页
centos7 源码安装mysql5.7.10

centos7 源码安装mysql5.7.10

作者: Fizz_YF | 来源:发表于2020-09-13 10:28 被阅读0次

Mysql5.7版本更新后有很多变化,比如json等,连安装都有变化,他安装必须要BOOST库,不过mysql的官网源码有带boost库的源码和不带boost库的源码两种,因此有两种安装方式,其实都是一样的,仅仅是不带boost库源码的需要单独安装boost

1、先下载源码:https://downloads.mysql.com/archives/community/
这里下载的是带boost

image.png
2、解压,cd到文件夹
tar -zxvf  mysql-boost-5.7.10.tar.gz
cd mysql-5.7.10

3、安装依赖包:yum -y install gcc gcc-c++ ncurses ncurses-devel cmake

4、添加禁止登陆的mysql用户,这里是www用户

groupadd www
useradd -r -g mysql -s /bin/false www

5、编译安装

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=boost
make#注意这里花费时间很长,大约70分钟
make install

6、修改配置文件,前提先创建/data/mysql目录,并且为www所有,修改/etc/my.cnf配置文件为一下内容

[client]
port=3306
socket=/data/mysql/mysql.sock
[mysqld]
port=3306
user=www
datadir=/data/mysql/data
socket=/data/mysql/mysql.sock
basedir=/usr/local/mysql
pid-file=/data/mysql/mysql.pid
log_error=/data/mysql/mysql-error.log
slow_query_log=1
long_query_time=1
slow_query_log_file=/data/mysql/mysql-slow.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

[mysqld_safe]
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

7、配置启动文件cp support-files/mysql.server /etc/init.d/mysqld
8、初始化数据库(没有提示,就是成功)/usr/local/mysql/bin/mysqld --initialize --user=www
9、启动/etc/init.d/mysqld start

image.png

10、MySQL从5.7开始不支持安装后使用空密码进行登录,因此在这里需要先查询程序生成的临时密码(就是第七步配置文件的日志文件路径):cat /data/mysql/mysql-error.log |grep 'A temporary password';也可以在配置文件my.cf增加skip-grant-tables重启mysql后可免密登录

image.png
11、配置环境变量:vim /root/.bash_profilePATH=$PATH:$HOME/bin修改为PATH=$PATH:$HOME/bin:/usr/local/mysql/bin,最后重新载入source /root/.bash_profile

12、连接mysqlmysql -uroot -p 然后输入刚刚第九步的密码,即可连接成功

image.png

13、这时需要修改密码:alter user 'root'@'localhost' identified by 'your_password';

好了,mysql5.7.10就安装成功了


若是要设置开机启动:systemctl enable mysqld.service
前提先设置mysqld.service。传送门

image.png

如果还有问题,不妨和我一起讨论。请多多关注:python基础

干货不定时更新喔

相关文章

  • MySQL相关文章索引(5)

    环境部署 centos7下使用yum安装mysql5.7.10 基本常识 boolean在mysql里是什么类型 ...

  • centos7 源码安装mysql5.7.10

    Mysql5.7版本更新后有很多变化,比如json等,连安装都有变化,他安装必须要BOOST库,不过mysql的官...

  • Centos7 多种方法 安装git

    源码安装 安装对应的依赖 下载源码编译安装 确保系统git 已经被卸载 rpm 安装(基于CentOS7)

  • Python基础知识

    Python下载地址:官方源码 centos7下安装方法 :Centos7安装Python3.5 Python B...

  • VPP基本安装

    以下安装方式在centos7上安装测试(可用)有三种安装方式:源码安装、yum安装、vpp-config安装 源码...

  • CentOS7上安装Nodejs

    CentOS7上安装Nodejs 下载源码 解压源码,并重命名源码 编译安装 配置NODE_HOME,进入prof...

  • CentOS7安装Tomcat8

    1 、安装说明 安装环境:CentOS7安装方式:源码安装软件:apache-tomcat-8.0.39-src....

  • centos7源码安装redis-5.0.0vv

    centos7源码安装redis-5.0.0 1.下载redis源码包 [root@localhostlocal]...

  • centos7源码安装lnmp

    centos7源码安装lnmp 相关链接 源码安装 使用systemd 编译选项 my.cnf配置文件说明 下载源...

  • centos7安装测试criu

    centos7安装criu 下载安装包 下载依赖包 安装源码 简单测试安装是否成功

网友评论

      本文标题:centos7 源码安装mysql5.7.10

      本文链接:https://www.haomeiwen.com/subject/ilrnektx.html