下载源码
源码下载地址:https://dev.mysql.com/downloads/mysql/ 找到对应版本进行下载上传至服务器
编译安装
使用cmake命令进行安装
cd mysql-8.0.35
mkdir bld
cd bld
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost ..
安装对应的依赖
apt-get install cmake
apt-get install openssl
apt-get install libssl-dev
apt-get install libncurses5-dev libncursesw5-dev
apt-get install pkg-config
开始执行make(漫长的等待...)
make && make isntall
创建用户
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
编辑配置文件
cd /usr/local/mysql
mkdir etc
cd etc
vim my.cnf
基础配置文件my.cnf
[mysqld]
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
log_error=/usr/local/mysql/error.log
配置权限
chown -R mysql:mysql /usr/local/mysql
chmod -R 750 /usr/local/mysql
初始化数据库
cd /usr/local/mysql/bin
./mysqld --defaults-file=/usr/local/mysql/etc/my.cnf --initialize-insecure // 不生成root的密码
启动数据库
./mysqld_safe &
标签:get,apt,cd,编译,源码,mysql8.0,usr,mysql,local
From: https://www.cnblogs.com/xingzr/p/17872249.html