当前位置:网站首页>源码编译安装MySQL
源码编译安装MySQL
2022-07-04 12:44:00 【墨染866】
系统环境:CentOS7.9
以下是编译安装的过程
安装包放到文章末尾了,自取
安装准备:上传压缩包
cmake-3.6.2.tar.gz
boost_1_59_0.tar.gz
mysql-5.7.37.tar.gz
yum install -y openssl* #安装依赖包
yum install -y ncurses-devel* libtirpc* rpcgen*
yum install -y gcc*
#上传安装包
cd /usr/local/src
rz cmake-3.6.2.tar.gz
rz boost_1_59_0.tar.gz
rz mysql-5.7.37.tar.gz
1)安装依赖包
#编译安装cmake
cd /usr/local/src
tar -xvf cmake-3.6.2.tar.gz
cd cmake-3.6.2
./bootstrap
gmake && gmake install
ln -s /usr/local/bin/cmake /usr/bin/
which cmake #验证cmkae是否安装成功
#编译安装boost
cd /usr/local/src
tar -xvf boost_1_59_0.tar.gz
mv /usr/local/src/boost_1_59_0 ../boost
2)安装MySQL
#编译安装mysql
mkdir -pv /usr/local/mysql/data
useradd -s /sbin/nologin -r mysql
cd /usr/local/src
tar -xvf mysql-5.7.37.tar.gz
cd mysql-5.7.37
cmake . -DCMAKE\_INSTALL\_PREFIX=/usr/local/mysql -DMYSQL\_DATADIR=/usr/local/mysql/data/ -DMYSQL\_UNIX\_ADDR=/usr/local/mysql/mysql.sock -DWITH\_INNOBASE\_STORAGE\_ENGINE=1 -DWITH\_MYISAM\_STORAGE\_ENGINE=1 -DENABLED\_LOCAL\_INFILE=1 -DEXTRA\_CHARSETS=all -DDEFAULT\_CHARSET=utf8 -DDEFAULT\_COLLATION=utf8\_general\_ci -DMYSQL\_USER=mysql -DWITH\_DEBUG=0 -DWITH\_EMBEDDED\_SERVER=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost
make && make install
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod 755 /etc/init.d/mysql
chown mysql.mysql /usr/local/mysql/ -R
ln -sf /usr/local/mysql/bin/\* /usr/bin/
ln -sf /usr/local/mysql/lib/\* /usr/lib/
ln -sf /usr/local/mysql/libexec/\* /usr/local/libexec
ln -sf /usr/local/mysql/share/man/man1/\* /usr/share/man/man1
ln -sf /usr/local/mysql/share/man/man8/\* /usr/share/man/man8
vim /etc/my.cnf
输入:
[mysqld]
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/mysql.sock
symbolic-links=0
default_authentication_plugin=mysql_native_password
[mysqld\_safe]
log-error=/var/log/mysql.log
pid-file=/var/run/mysql.pid
!includedir /etc/my.cnf.d
#my.cnf中的目录和文件必须存在
touch /var/log/mysql.log
chown mysql:mysql /var/log/mysql.log
touch /var/run/mysql.pid
chown mysql:mysql /var/run/mysql.pid
mkdir /etc/my.cnf.d
#添加到全局变量
vim /etc/profile
输入:
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
#初始化数据库
/usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
service mysql start
mysql -uroot -p #连接数据库
set password='XXXXX'; #修改密码
exit
mysql -uroot -p'XXXXX' #连接并登录数据库
最终能进入到这个界面就说明安装成功

软件包:
链接:https://pan.baidu.com/s/1ivw9Rzxf3Bd-k7HIJJxUcQ
提取码:AK47
边栏推荐
- Database lock table? Don't panic, this article teaches you how to solve it
- 阿里云有奖体验:用PolarDB-X搭建一个高可用系统
- Use fail2ban to prevent password attempts
- iptables基础及Samba配置举例
- 提高MySQL深分页查询效率的三种方案
- WPF double slider control and forced capture of mouse event focus
- 《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
- Simple understanding of binary search
- Annual comprehensive analysis of China's mobile reading market in 2022
- Scripy framework learning
猜你喜欢

Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
Three schemes to improve the efficiency of MySQL deep paging query

数据库公共字段自动填充
![[cloud native | kubernetes] in depth understanding of ingress (12)](/img/34/67eae1e5df89bb0a356a1c29a5e007.png)
[cloud native | kubernetes] in depth understanding of ingress (12)

Runc hang causes the kubernetes node notready

The only core indicator of high-quality software architecture

After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)

CommVault cooperates with Oracle to provide metallic data management as a service on Oracle cloud

SQL statement syntax error in test SQL statement deletion in eclipse linked database
提高MySQL深分页查询效率的三种方案
随机推荐
从0到1建设智能灰度数据体系:以vivo游戏中心为例
Flet教程之 03 FilledButton基础入门(教程含源码)(教程含源码)
Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
C foundation in-depth study I
C#基础深入学习二
C语言程序设计
8个扩展子包!RecBole推出2.0!
Alibaba cloud award winning experience: build a highly available system with polardb-x
AI painting minimalist tutorial
[AI system frontier dynamics, issue 40] Hinton: my deep learning career and research mind method; Google refutes rumors and gives up tensorflow; The apotheosis framework is officially open source
MySQL three-level distribution agent relationship storage
C语言图书租赁管理系统
Commvault 和 Oracle 合作,在 Oracle 云上提供 Metallic数据管理即服务
Configure WebDAV server on Apache
C语言个人通讯录管理系统
在 Apache 上配置 WebDAV 服务器
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
高效!用虚拟用户搭建FTP工作环境
Rsyslog配置及使用教程