当前位置:网站首页>源码编译安装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
边栏推荐
- Flet教程之 03 FilledButton基础入门(教程含源码)(教程含源码)
- 在 Apache 上配置 WebDAV 服务器
- WPF double slider control and forced capture of mouse event focus
- When MDK uses precompiler in header file, ifdef is invalid
- 使用宝塔部署halo博客
- Commvault 和 Oracle 合作,在 Oracle 云上提供 Metallic数据管理即服务
- 再说rsync+inotify实现数据的实时备份
- Talk about the design and implementation logic of payment process
- Configure WebDAV server on Apache
- Iptables foundation and Samba configuration examples
猜你喜欢

Oracle was named the champion of Digital Innovation Award by Ventana research

JVM系列——栈与堆、方法区day1-2

ViewBinding和DataBinding的理解和区别

Talk about the design and implementation logic of payment process

Samsung's mass production of 3nm products has attracted the attention of Taiwan media: whether it can improve the input-output rate in the short term is the key to compete with TSMC

A data person understands and deepens the domain model

诸神黄昏时代的对比学习

【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源

ASP.NET Core入门一

Annual comprehensive analysis of China's mobile reading market in 2022
随机推荐
C语言集合运算
ASP.NET Core入门一
7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多
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)
Backgroundworker usage example
C语言个人通讯录管理系统
6 分钟看完 BGP 协议。
Read the BGP agreement in 6 minutes.
聊聊支付流程的设计与实现逻辑
Web知识补充
实时云交互如何助力教育行业发展
Dgraph: large scale dynamic graph dataset
It is six orders of magnitude faster than the quantum chemical method. An adiabatic artificial neural network method based on adiabatic state can accelerate the simulation of dual nitrogen benzene der
Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
8 expansion sub packages! Recbole launches 2.0!
MySQL three-level distribution agent relationship storage
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
"Pre training weekly" issue 52: shielding visual pre training and goal-oriented dialogue
XML入门一