当前位置:网站首页>Centos7 installs MySQL 5.7 through Yum and enables remote access
Centos7 installs MySQL 5.7 through Yum and enables remote access
2022-07-18 09:39:00 【nineteen million nine hundred and twenty-one thousand one hundr】
Preface
Mysql We all understand , I just want to make more introductions , Go straight ahead mysql Installation of , The following records if it passes yum install mysql5.7, This method is also applicable to installation 8.0,5.6,5.5 etc. mysql edition
Text
1. Delete mariadb
centos7 By default... Will be installed mysql Another branch version of mariadb, In the installation mysql front , It needs to be deleted
# Find out mariadb Of rpm package
$ rpm -qa|grep mariadb
mariadb-libs-5.5.44-2.el7.centos.x86_64
# Ignore dependencies , Delete this package
$ rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_642. Add official yum Source and install mysql
visit mysql official yum Source download address , Select the system , Click to download , Enter the page , Copy download connection


# Download and install this yum Warehouse
$ rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
# After installation , this yum By default, the source warehouse is installed mysql The latest version 8.0 edition .
# We need to modify the following items in the document , Make it download 5.7 edition , If you want to install another version , Open the corresponding version , Close other versions .
$ vim /etc/yum.repos.d/mysql-community.repo
----------------------------------------------------------------
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1 # There will be 0 Change it to 1, Turn on 5.7 edition
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/
enabled=0 # There will be 1 Change it to 0, close 8.0 edition
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
----------------------------------------------------------------
# After the modification is completed , install mysql5.7
$ yum install -y mysql-community-serverAfter installation , The configuration file is /etc/my.cnf Configure according to the actual situation .
3. Start the service , Turn on Remote Access
# start-up mysql service
$ systemctl start mysqld
# Set to enable self start
$ systemctl enable mysqld
# First boot mysql after , An initial password will be automatically generated in the log file , The default log file path is :/var/log/mysqld.log
# Find the initialization password
$ cat /var/log/mysqld.log |grep password
2019-06-18T12:12:04.161088Z 1 [Note] A temporary password is generated for [email protected]: 2%w)IDysCVZQ
# The password here is the one output above , Use this password to log in mysql
$ mysql -u root -p
# Copy password output , Get into mysql
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.26
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
# Change Password ,mysql5.7 The default password strength of is very high , Case is required , Symbols and numbers , Longer than 6, Be short of one cannot
mysql> alter user 'root'@'localhost' identified by 'your_password';
Query OK, 0 rows affected (0.00 sec)
# If you don't want such a complicated password , Change the password strength to the minimum , That is, only judge the password length
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
# Turn on Remote Access
$ grant all privileges on *.* to 'root'@'%' identified by 'your_password';
Query OK, 0 rows affected, 1 warning (0.00 sec)
# Refresh permissions take effect
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
# That's it mysql The initial setting of , Now you can use your account and password , Visit this mysql Yes
# Don't forget to open the database before accessing 3306 port
$ firewall-cmd --add-port=3306/tcp --permanent
$ firewall-cmd --reloadend
ok, It's so simple mysql5.7 Of yum install , Through this method, you can also install mysql5.5,5.6,8.0 These versions . As long as the official yum Warehouse support is ok , Very simple and convenient .
边栏推荐
- Codeforces Round #804 A The Third Three Number Problem
- Is it safe for Huatai Securities to open an account online? Is the fund guaranteed?
- Codeforces Round #802 A. Optimal Path
- leetcode双指针水题题解
- 功能、模块质量和非功能性测试
- [Space & single cell omics] phase 2: combined single cell and bulk transcriptome to identify two epithelial tumor cell states in colorectal cancer, and improved CMS typing
- Stm32f030 is stuck with timer interrupt
- 证券开户国泰君安?安全吗?
- Leetcode-128-longest continuous sequence
- 【空间&单细胞组学】第2期:联合单细胞和bulk转录组鉴定了结直肠癌中两种上皮肿瘤细胞状态,并完善了CMS分型
猜你喜欢
![[ArcGIS creates a small picture frame of islands and nine segment lines in the South China Sea]](/img/5e/5d81afb511d22214a2545121f22300.png)
[ArcGIS creates a small picture frame of islands and nine segment lines in the South China Sea]

脚本编写规则和变量定义

Codeforces Round #803 (Div. 2) D. Fixed Point Guessing

A few minutes before work, I thoroughly understood json stringify()

WTK6900H语音识别单芯片实现智能语音识别蓝牙耳机方案设计

LeetCode-128-最长连续序列

【空间&单细胞组学】第2期:联合单细胞和bulk转录组鉴定了结直肠癌中两种上皮肿瘤细胞状态,并完善了CMS分型

Codeforces Round #803 (Div. 2) A. XOR Mixup

CSDN blog expert exclusive honor award is coming

Codeforces Round #804 C The Third Problem
随机推荐
Codeforces Round #803 (Div. 2) C. 3SUM Closure
Opengauss cooperates with industry innovation to build a root community of open source databases
sql语句
idea 新建项目时克隆仓库代码
2022-7-15 Leetcode 151. Reverse the words in the string - [split from back to front]
Leetcode-240-search two-dimensional matrix II
408天勤第八章排序课内代码合集
datax扩展vertica插件
C语言自定义类型(结构体,位段,枚举,联合体)
Nodejs直接使用proto文件
Idea import jar package operation and XML file configuration file
功能、模块质量和非功能性测试
Codeforces Round #806 (Div. 4) A - G
Grow up Summer Challenge | learn / create from the boss, and get CSDN gift bag, exclusive certificate of honor, commemorative T-shirt and medal!
华为交换技术:BGP基础实验
Codeforces Round #802 B. Palindromic Numbers
CAN通信(2)——CAN通信协议层
Help, update to Siyuan v2.0.27, dark+ theme adaptive width problem
atcoder ABC 232 B~E题解
Codeforces Round #802 D. River Locks