当前位置:网站首页>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'

边栏推荐
猜你喜欢
![[pta-- use queues to solve the problem of monkeys choosing kings]](/img/54/94359fb3557ac07f7786ecf61a5409.png)
[pta-- use queues to solve the problem of monkeys choosing kings]

Battle plague Cup -- strange shape

Analysis of reentrantlock source code of AQS

Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking

单元测试框架Jest搭配TypeScript的安装与配置

mongoDB复制集及分片集群
![[hash table basics]](/img/8f/54a4780a02f81e5de3d92c25248e1e.png)
[hash table basics]

Water bottle effect production

Graphic pipeline foundation (I)

SSAO by computer shader (III)
随机推荐
[untitled]
MySQL index optimization
AQS之semaphore源码分析
Dynamic memory management function of C language
Analysis of cyclicbarrier source code of AQS
rancher部署实战
It is recommended to wear air conduction earphones, which do not need to wear in ear
思寒漫谈测试人职业发展
How to calculate the size of structure, segment and Consortium (common body)
HDU-1097-A hard puzzle(快速幂)
mongo ssl 配置实战
CentOS7部署MySQL数据库服务器
Feignclient @requestmapping parameter setting and simple method setting of request header
Project compilation nosuch*** error problem
OJ 1284 counting problem
Initializingbean interface and examples
遍历 二叉树
Compilation and preprocessing of C language
[dynamic planning -- the best period series for buying and selling stocks]
TCP/IP五层模型