欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

如何通過(guò)yum方式安裝mysql數(shù)據(jù)庫(kù)

 更新時(shí)間:2024年01月02日 10:06:01   作者:阿樂(lè)哥哥  
部署MySQL數(shù)據(jù)庫(kù)有多種部署方式,常用的部署方式就有三種,yum安裝、rpm安裝以及編譯安裝,這篇文章主要給大家介紹了關(guān)于如何如果通過(guò)yum方式安裝mysql數(shù)據(jù)庫(kù)的相關(guān)資料,需要的朋友可以參考下

安裝包獲取

MySQL :: Download MySQL Community Server:https://dev.mysql.com/downloads/mysql/

MySQL :: Download MySQL Yum Repository:https://dev.mysql.com/downloads/repo/yum/

 環(huán)境

yum install wget
 
yum install lrzsz
 
yum install unzip
 
setenforce 0

一.官方y(tǒng)um源方式安裝

8.0版本
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
這里需要安裝5.7版本  sz直接拖入

8.0

 5.7版本放在/opt/文件夾下  并解壓

如果需要升級(jí)包可以用下面的命令

rpm -Uvh mysql80-community-release-el7-3.noarch.rpm

二、安裝需要的版本

查看所有版本

yum repolist all | grep mysql

 這里5.7版本是不可用的 8.0的能用 所以需要先禁用8.0的然后開(kāi)啟5.7版本的

yum-config-manager --disable mysql80-community 

#注意#: 如果運(yùn)行 yum-config-manager命令提示 -bash: yum-config-manager: command not found 命令未找到,因?yàn)?yum-config-manager 在 yum-utils包里面。由于系統(tǒng)默認(rèn)沒(méi)有這個(gè)命令,需要另外進(jìn)行安裝

安裝yum-config-manager

yum -y install yum-utils

如果報(bào)錯(cuò)如下: The GPG keys listed for the “MySQL 5.7 Community Server” repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
echo insecure >> ~/.curlrc

 例子:出現(xiàn)以下問(wèn)題 查看8.0版本是否禁用 5.7版本開(kāi)啟

 使用命令

 完成

啟用5.7版本

yum-config-manager --enable mysql57-community

三、安裝MySQL

yum install -y mysql-community-server

驗(yàn)證MySQL

mysql --version

 啟用成功可以查看到版本

四、啟動(dòng)MySQL

查看啟動(dòng)狀態(tài) 
systemctl status mysqld.service

啟動(dòng)

關(guān)閉防火墻 systemctl stop firewalld
systemctl start mysqld.service

登錄MySQL

MySql服務(wù)器初始化會(huì)創(chuàng)建 'root@localhost’的一個(gè)超級(jí)用戶(hù)賬號(hào)。設(shè)置超級(jí)用戶(hù)的密碼并將其存儲(chǔ)在錯(cuò)誤日志文件中

 
grep 'temporary password' /var/log/mysqld.log

 例子:

使用臨時(shí)密碼登錄Mysql

mysql -u root -p'nYZWlu&Qr4S('
引號(hào)內(nèi)密碼

例子:

重置密碼

ALTER USER 'root'@'localhost' IDENTIFIED BY 'ggxl886...';

如果密碼設(shè)置的太簡(jiǎn)單可能會(huì)報(bào)錯(cuò),如下:

解決方法:

set global validate_password_length=6;
set global  validate_password_policy=0;
show variables like "%validate%";

五、開(kāi)啟遠(yuǎn)程連接

進(jìn)入mysql庫(kù)執(zhí)行命令 、

use mysql
select host ,user from user; 

修改權(quán)限   把root用戶(hù)的host改為%

update user set host = "%" where user = "root";

刷新權(quán)限

flush privileges;

創(chuàng)建數(shù)據(jù)庫(kù)時(shí)

create database <數(shù)據(jù)庫(kù)名>

創(chuàng)建表

create table test(name varchar(20) not null,id int not null,age int not null ) default charset = utf8;

六.用navicat 連接連接數(shù)據(jù)庫(kù)

總結(jié)

到此這篇關(guān)于通過(guò)yum方式安裝mysql數(shù)據(jù)庫(kù)的文章就介紹到這了,更多相關(guān)yum安裝mysql數(shù)據(jù)庫(kù)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論