Open source office development platform mysql5.7 two sets of four node master-slave structure environment building tutorial (1)

open source office development platform

One 、Mysql5.7.29 Server download

Server download link :


Two 、 Single instance server installation process

2.1、 Create installation package storage directory :

mkdir -p /server/tools

2.2、 Create an application unzip installation directory :

mkdir -p /application

2.3、 Unzip the server program in the installation package directory :

tar -xf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz

2.4、 Move the extracted server directory to the installation directory :

mv mysql-5.7.29-linux-glibc2.12-x86_64 /application/mysql

Server directory planning :



2.5、 Create database data storage directory :

mkdir -p /data/mysql/data

2.6、 establish mysql Start the user :

useradd -s /sbin/nologin mysql

2.7、 Modify environment variables , take mysqld Command to the environment variable :

vim /etc/profile
export PATH=/application/mysql/bin:$PATH


source /etc/profile


2.8、 Inquire about Mysql Server version

mysql -V


2.9、 Error reporting solution :

mysql: error while loading shared libraries: cannot open shared object file: No such file or directory

resolvent :yum install libncurses*



2.11 Directory authorization :

chown -R mysql.mysql /application/*

chown -R mysql.mysql /data


3、 ... and 、 Initialization data ( Create system data )

3.1 Initialization command

5.6 edition   Initialization command :


5.7 edition   Initialization command :

mkdir -p /data/mysql/data

chown -R mysql.mysql /data

mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/data/mysql/data

explain :

--initialize Parameters :

1、 Customize the password complexity :12 position ,4 Kind of

2、 Password expiration time :180

3、 to root@localhost The user sets a temporary password


If you need to initialize without generating the initial password , Then you can use --initialize-insecure Data initialization

Delete the original generated data first , If not, skip this step :

\rm -rf /data/mysql/data/*

mysqld --initialize-insecure --user=mysql --basedir=/application/mysql --datadir=/data/mysql/data


Four 、 Database configuration and startup

4.1 Add configuration file :

cat >/etc/my.cnf <<EOF












4.2 Start database

1. sys-v  

1) Use mysqld The command starts directly

cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld

service mysqld restart


Successful launch !


2) /etc/init.d/mysqld restart perhaps /etc/init.d/mysqld --defaults-file=/etc/my.cnf restart


4.2.2 Use systemctl Start database

1、 Create services mysqld3306.service

cat >/etc/systemd/system/mysqld3306.service<<EOF


Description=MySQL Server










ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf

LimitNOFILE = 5000



Check SELINUX To configure :

Permanent shutdown needs to be modified /etc/selinux/config Just restart the machine again



2、 Start database

systemctl start mysqld3306



4.3 Startup status and port query

netstat -lnp|grep 3306




5、 ... and 、 Administrator password settings (root@localhost)

mysqladmin -uroot -p password zone2018




When something goes wrong , The way to look up questions :

1、 Error log :/data/3307/mysql.log

2、systemctl status mysqld3307.service

3、journalctl -xe


terms of settlement : Permanent shutdown needs to be modified /etc/selinux/config Just restart the machine again


( From the public number : Zhejiang Rand network )

本文为[O2oa enterprise information platform]所创,转载请带上原文链接,感谢

  1. J2EE
  2. Vue uses SDK to upload seven cows
  3. k8s-dns
  4. JavaScript mailbox verification - regular verification
  5. k8s-dashboard
  6. How many questions can you answer?
  7. Spring annotation -- transactional
  8. [k8s cluster] construction steps
  9. k8s-kubeadm
  10. k8s-etcd
  11. Using HashMap to improve search performance in Java
  12. There is no class problem when Maven publishes jar package
  13. JavaScriptBOM操作
  14. J2EE
  15. k8s-prometheus-memory
  16. k8s-prometheus disk
  17. k8s-prometheus
  18. JavaScript BOM operation
  19. k8s-prometheus-memory
  20. k8s-prometheus disk
  21. k8s-prometheus
  22. Linux Disk Command
  23. Linux FS
  24. 使用docker-compose &WordPress建站
  25. Linux Command
  26. This time, thoroughly grasp the depth of JavaScript copy
  27. Linux Disk Command
  28. Linux FS
  29. Using docker compose & WordPress to build a website
  30. Linux Command
  31. 摊牌了,我 HTTP 功底贼好!
  32. shiro 报 Submitted credentials for token
  33. It's a showdown. I'm good at it!
  34. Shiro submitted credentials for token
  35. Linux Stress test
  36. Linux Root Disk Extension
  37. Linux Stress test
  38. Linux Root Disk Extension
  39. Redis高级客户端Lettuce详解
  40. springboot学习-综合运用(一)
  41. 忘记云服务器上MySQL数据库的root密码时如何重置密码?
  42. Detailed explanation of lettuce, an advanced client of redis
  43. Springboot learning integrated application (1)
  44. Linux File Recover
  45. Linux-Security
  46. How to reset the password when you forget the root password of MySQL database on the cloud server?
  47. Linux File Recover
  48. Linux-Security
  49. LiteOS:盘点那些重要的数据结构
  50. Linux Memory
  51. Liteos: inventory those important data structures
  52. Linux Memory
  53. 手把手教你使用IDEA2020创建SpringBoot项目
  54. Hand in hand to teach you how to create a springboot project with idea2020
  55. spring boot 整合swagger2生成API文档
  56. Spring boot integrates swagger2 to generate API documents
  57. linux操作系统重启后 解决nginx的pid消失问题
  58. Solve the problem of nginx PID disappearing after Linux operating system restart
  59. JAVA版本号含义
  60. The meaning of java version number