当前位置:网站首页>Centos7 deploy MySQL database server
Centos7 deploy MySQL database server
2022-07-28 06:50:00 【[dissimilarity space]】
CentOS7 Deploy MySQL database server
Environmental preparation
- host
| Host name | IP Address 1( Extranet ) | IP Address 2( Intranet ) | System | other |
|---|---|---|---|---|
| mysql-server | 192.168.72.130 | 202.207.240.130 | CetOS7.5.1804 | MEM:2G ;CPU:2P/2C;DISK:15G |
- Turn off security components such as firewalls
- To configure CentOS-Base Source
- To configure mysql Install source (yum The installation method requires )
explain : In this paper, the experimental method is yum And binary installation MySQL, among MySQL The version is 5.xx
YUM install
mkdir -p /server/tools
wget -O /server/tools/mysql-community-release-el7-5.noarch.rpm http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh /server/tools/mysql-community-release-el7-5.noarch.rpm
Uninstall the default mariadb
rpm -aq mariadb* rpm -e --nodeps mariadb-libsinstall mysql
yum install mysql mysql-server -ystart-up mysql service
systemctl start mysqld systemctl enable mysqldEnter the command
mysqlverification mysql Is the installation successful

Set up mysql Database password
mysqladmin -uroot password 'xxxxxx'
Binary installation
Download binary mysql software package
Download address :https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
It is recommended to download in advance and upload to the specified directory , The package is relatively large, and the online download is slow
mkdir -p /server/tools
cd /server/tools
wget https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
cd /server/tools
tar xzvf mysql-5.7.35-linux-glibc2.12-x86_64.tar.gz
mkdir -p /application
mv mysql-5.7.35-linux-glibc2.12-x86_64 /application/mysql-5.7.35
ln -s /application/mysql-5.7.35 /application/mysql
rpm -aq mariadb*
rpm -e --nodeps mariadb-libs
yum install libaio-devel -y
useradd mysql -s /sbin/nologin -M
mkdir -p /application/mysql/data
chown -R mysql:mysql /application/mysql
cat >/etc/my.cnf <<EOF [mysqld] basedir = /application/mysql datadir = /application/mysql/data socket = /tmp/mysql.sock server_id = 1 port = 3306 log_error = /application/mysql/data/error_mysql.err [mysql] socket = /tmp/mysql.sock prompt = wjz [\\d]> EOF
/application/mysql/bin/mysqld --initialize-insecure --user=mysql \
--basedir=/application/mysql/ --datadir=/application/mysql/data
cat >/usr/lib/systemd/system/mysql.service <<EOF [Unit] Description=MySQL5.7.35 database server After=syslog.target After=network.target [Service] User=mysql Group=mysql ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf LimitNOFILE = 5000 [Install] WantedBy=multi-user.target EOF
After writing , You can start mysql To test
systemctl start mysql
systemctl enable mysql
systemctl status mysql

echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
source /etc/profile

mysqladmin -uroot password 'xxxxxx'

边栏推荐
猜你喜欢

从普通查询商品到高并发查询商品的优化思路

技术分享 | 服务端接口自动化测试, Requests 库的这些功能你了解吗?

archery数据库审核平台部署

Graphic pipeline foundation (part outside)

技术分享 | 使用postman发送请求

How to simulate the implementation of strcpy library functions

Leetcode brush question diary sword finger offer II 055. binary search tree iterator

水瓶效果制作

技术分享 | 接口测试价值与体系

Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
随机推荐
代码整洁之道(二)
File operation in C language
Problem solving for ACM freshmen in Jiangzhong on October 26
单元测试框架Jest搭配TypeScript的安装与配置
JS四则运算重新封装,解决精度丢失问题
SSAO by computer shader (II)
Everything you don't know about time complexity is here
Graphic pipeline foundation (part outside)
Dynamic programming -- simple question type of climbing stairs
Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
How to calculate the size of structure, segment and Consortium (common body)
SSAO by computer shader (III)
如何描述一个BUG以及BUG级别的定义、生命周期
Project compilation nosuch*** error problem
OJ 1505 fuse
[dynamic planning -- the best period for buying and selling stocks Series 2]
RayMarching实现体积光渲染
Analysis of the semaphore source code of AQS
OJ 1020 minimum palindromes
Analysis of cyclicbarrier source code of AQS