当前位置:网站首页>源码编译安装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
边栏推荐
- 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
- Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
- N++ is not reliable
- 《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
- go-zero微服务实战系列(九、极致优化秒杀性能)
- C array supplement
- FS4056 800mA充电ic 国产快充电源ic
- C语言宿舍管理查询软件
- C#基础深入学习一
- C语言个人通讯录管理系统
猜你喜欢
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
HAProxy高可用解决方案
[cloud native | kubernetes] in depth understanding of ingress (12)
Reptile exercises (I)
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
2022年中国移动阅读市场年度综合分析
Zhongang Mining: in order to ensure sufficient supply of fluorite, it is imperative to open source and save flow
Meituan Ali's Application Practice on multimodal recall
ASP.NET Core入门一
随机推荐
Runc hang causes the kubernetes node notready
Backgroundworker usage example
Besides, rsync+inotify realizes real-time backup of data
聊聊支付流程的设计与实现逻辑
Scripy framework learning
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
Read the BGP agreement in 6 minutes.
SQL语言
Using nsproxy to forward messages
mysql三级分销代理关系存储
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
The old-fashioned synchronized lock optimization will make it clear to you at once!
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
XML入门二
Alibaba cloud award winning experience: build a highly available system with polardb-x
"Pre training weekly" issue 52: shielding visual pre training and goal-oriented dialogue
CVPR 2022 | TransFusion:用Transformer进行3D目标检测的激光雷达-相机融合
Talk about the design and implementation logic of payment process
eclipse链接数据库中测试SQL语句删除出现SQL语句语法错误
WPF double slider control and forced capture of mouse event focus