当前位置:网站首页>MySQL introduction and installation (I)
MySQL introduction and installation (I)
2022-06-12 21:44:00 【Stay up late and soak wolfberry】
List of articles
1. MySQL Learning route
Chapter one Introduction and installation
Chapter two Architecture and basic management
The third chapter SQL Basics
Chapter four Index and Implementation plan
The fifth chapter Storage engine
Chapter six Log management
Chapter vii. Backup and recovery
Chapter viii. Master slave replication and architecture evolution
Chapter nine High availability and read / write separation architecture
Chapter ten Distributed architecture
Chapter ten Comprehensive optimization
Chapter 11 NoSQL-redis/mongodb/ES
Search engine database ranking :https://db-engines.com/en/ranking
2. MySQL Introduce
2.1 Data form
data : written words 、 picture 、 video ... Data representation of human cognition
Computer : Binary system 、16 Binary machine language
Based on the importance and complexity of the data , We may have different management methods .
What data is suitable for storage in the database ?
Of high importance
Data with complex relationships
2.2 Database management system DBMS
RDBMS: Relational database management system
It's more suitable for , Data with high security level requirements and data with complex relationships
NoSQL: Non relational database management system
Suitable for high performance data access , In general, it's cooperation RDBMS For use
For big data processing and Analysis , Distributed architecture is better at
2.3 Database management system type
RDBMS :
MySQL 、Oracle、MSSQL(SQL Server)、PG
NoSQL:Not Only SQL
key - value (key-value):Redis, memcached
file (document):Mongodb( Store historical orders 、 Running water )、ES( Search box )
3. MySQL product line
3.1 MySQL manufacturer
Oracle: MySQL Official edition
Redhat: MariaDB
Percona: PerconaDB
3.2 MySQL Version selection
5.6 :2021 year 2 Month stopped updating . Quit the stage of history immediately .
5.7 :5.7.31+
8.0 :8.0.20+
Version number designation :
The core system 5731
Edge system 8020
3.3 MySQL Software access
www.mysql.com ---> downloads
Enterprise Edition :Enterprise , The Internet industry generally does not choose .
Community version : choice , Enterprises use and learn to use
Source package :source code .tar.gz, Generally, when looking at the source code, look at the installation
Binary package :

Source package :
3.4 MySQL Installation mode
General binary version : Decompression is used immediately. ( The green version )
rpm、yum edition : download rpm Package or configuration yum Source
Source package : Compilation and installation , Very slow
4. MySQL-5.7.28 Binary package installation
4.1 Environmental preparation
(1) Get ready Centos 7.6 virtual machine
[root@db01 ~]# hostname -I
10.0.0.61
[root@db01 ~]# hostname
db01
(2) Clean up the historical environment
[root@db01 ~]# rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
mariadb-server-5.5.68-1.el7.x86_64
mariadb-5.5.68-1.el7.x86_64
[root@db01 ~]# yum remove mariadb-libs.x86_64 -y
(3) Create users and groups
[root@db01 ~]# useradd mysql -s /sbin/nologin
[root@db01 ~]# id mysql
uid=1001(mysql) gid=1001(mysql) groups=1001(mysql)
(4) Create related directories
# Create a software catalog
[root@db01 ~]# mkdir -p /app/database/
# Create a data directory
[root@db01 ~]# mkdir -p /data/3306/
# Create a log directory
[root@db01 ~]# mkdir -p /binlog/3306/
(5) Set the permissions
[root@db01 ~]# chown -R mysql.mysql /app/ /data/ /binlog/
4.2 Upload and unzip MySQL Software
[root@db01 ~]# cd /app/database/
[root@db01 database]# tar xf mysql-5.7.30-linux-glibc2.12-x86_64.tar.gz
[root@db01 database]# ln -s mysql-5.7.30-linux-glibc2.12-x86_64 mysql
4.3 Set the environment variable
[root@db01 ~]# vim /etc/profile
# Add the following lines :
export PATH=/app/database/mysql/bin:$PATH
# Effective configuration
[root@db01 ~]# source /etc/profile
4.4 Initialize system library table
Tips :rmp The package automatically completes the initialization operation
# Installation dependency , Prevent initialization error
[root@db01 ~]# yum install -y libaio-devel
# To initialize
[root@db01 ~]# mysqld --initialize-insecure --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
# The lack of libaio-devel rely on , Initialization error :
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
# An error that is easy to report :
[root@db01 ~]# mysqld --initialize-insecure --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
2022-06-08T14:03:39.492759Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-06-08T14:03:39.494239Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2022-06-08T14:03:39.494260Z 0 [ERROR] Aborting
# reason + solve : If an error occurs during the first initialization , This error may be reported during the second initialization
[root@db01 ~]# rm -rf /data/3306/*
[root@db01 ~]# mysqld --initialize-insecure --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
Expand :
# 5.7 The initialization mode of subsequent versions
# mysqld --initialize-insecure --user=mysql --basedir= Software path --datadir= Data path
(1) mysqld --initialize
Will generate 12 Bit random temporary password ( Administrator user ), Four types of password complexity .
Temporarily generate password , Can only be used to log in . Cannot be used to manage databases . Reset it the first time you log in
[root@db01 data]# mysql -uroot -p'Uh0*xe(eLw(W'
mysql> create database test;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement
mysql> alter user root@'localhost' identified by '123';
mysql> create database test;
Or change the password like this :
[root@db01 data]# mysqladmin -uroot -p password [email protected]
# Enter the initialization password
Enter password:
(2) mysqld --initialize-insecure
The administrator password is empty
# 5.7 Initialization mode of previous version ( for example 5.6)
# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir= Software installation path --datadir= Data directory
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/app/database/mysql --datadir=/data/3306/
4.5 Profile Settings
[root@db01 ~]# cat > /etc/my.cnf <<EOF
[mysqld]
user=mysql
basedir=/app/database/mysql
datadir=/data/3306/
server_id=6
port=3306
socket=/tmp/mysql.sock
[mysql]
socket=/tmp/mysql.sock
EOF
4.6 Get ready MySQL The startup script
[root@m01 ~]# cd /app/database/mysql/support-files/
# Copy mysql To the system software management directory
[root@m01 support-files]# cp mysql.server /etc/init.d/mysqld
# centos6
[root@m01 ~]# service mysqld start
Starting MySQL.Logging to '/data/3306/m01.err'.
SUCCESS!
# centos7
# take /etc/init.d/mysqld Add to systemd In management
[root@m01 ~]# chkconfig --add mysqld
[root@m01 ~]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[root@m01 ~]# systemctl start mysqld
边栏推荐
- Limit of advanced mathematics
- Ansible-大总结(六)
- PCB封装下载网站推荐及其详细使用方法
- [qnx hypervisor 2.2 manuel de l'utilisateur] 4.2 environnement de construction pris en charge
- The Post-00 financial woman with a monthly salary of 2W conquered the boss with this set of report template
- Ansible PlayBook et ansible roles (3)
- Oracle 19c 安装文档
- Module 8: Design message queue MySQL table for storing message data
- What are thread scheduler and timeslicing?
- ZGC concurrent identity and multi view address mapping in concurrent transition phase
猜你喜欢

MySql主从复制

SQL调优指南笔记10:Optimizer Statistics Concepts

复杂系统如何检测异常?北卡UNCC等最新《复杂分布式系统中基于图的深度学习异常检测方法综述》,阐述最新图异常检测技术进展

Build a highly available database

Compiling process of OpenSSL and libevent on PC

How do complex systems detect anomalies? North Carolina UNCC and others' latest overview of graph based deep learning anomaly detection methods in complex distributed systems describes the latest prog

SQL tuning guide notes 13:gathering optimizer statistics

SQL调优指南笔记6:Explaining and Displaying Execution Plans

Oracle LiveLabs实验:Introduction to Oracle Spatial

Icml2022 | galaxy: active learning of polarization map
随机推荐
同花顺能开户吗,在APP上可以直接开通券商安全吗 ,证券开户怎么开户流程
User guide for JUC concurrency Toolkit
测试基础之:单元测试
drf 接收嵌套数据并创建对象, 解决:drf NOT NULL constraint failed
一款高颜值的MySQL管理工具
Limit of advanced mathematics
Simple understanding of cap and base theory
[QNX hypervisor 2.2 user manual] 4.4 build host
RestTemplate的@LoadBalance注解
Oracle LiveLabs实验:Introduction to Oracle Spatial Studio
PE安装win10系统
What is your understanding of thread priority?
The ifeq, filter and strip of makefile are easy to use
ZGC concurrent identity and multi view address mapping in concurrent transition phase
Digital intelligence data depth | Bi goes down the altar? It's not that the market has declined, it's that the story has changed
Experiment 7-2-6 print Yanghui triangle (20 points)
What are thread scheduler and timeslicing?
[target detection] |dive detector into box for object detection new training method based on fcos
What is the difference between a user thread and a daemon thread?
OceanBase 社区版 OCP 功能解读