亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

數(shù)據(jù)庫(kù)mysql的四種安裝方式(非常全面?。?/h1>
 更新時(shí)間:2024年02月20日 15:51:20   作者:小胖鯨~  
這篇文章主要給大家介紹了關(guān)于數(shù)據(jù)庫(kù)mysql的四種安裝方式,文中通過(guò)圖文以及代碼介紹的非常詳細(xì),不論你是初學(xué)者還是有經(jīng)驗(yàn)的開(kāi)發(fā)者,都希望你能從這個(gè)教程中收獲知識(shí)與樂(lè)趣,需要的朋友可以參考下

一,倉(cāng)庫(kù)安裝

1,使用rpm命令從指定的網(wǎng)址裝包

?[root@localhost yum.repos.d]# rpm -ivh  https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm?

2,查看已經(jīng)安裝的倉(cāng)庫(kù)id和倉(cāng)庫(kù)名稱,會(huì)發(fā)現(xiàn)多了以下幾個(gè)倉(cāng)庫(kù)

 MySQL Connectors Community; MySQL Tools Community  ;MySQL 8.0 Community Server;

[root@localhost yum.repos.d]# yum repolist

3,安裝mysql軟件

[root@wangjingjing yum.repos.d]# dnf install mysql-server -y

4,運(yùn)行mysql軟件

[root@localhost yum.repos.d]# systemctl start mysqld

5,查看mysqld服務(wù)的狀態(tài)

[root@wangjingjing yum.repos.d]# systemctl status mysqld

6,在/var/log/mysqld.log目錄下面查看數(shù)據(jù)庫(kù)root的臨時(shí)密碼

[root@localhost yum.repos.d]# grep 'temporary password' /var/log/mysqld.log

7,使用臨時(shí)密碼登錄數(shù)據(jù)庫(kù)(密碼和-p之間不能有空格)

[root@localhost yum.repos.d]# mysql -uroot -p' 9tJZ4JPtVa,)'

8,必須重置root用戶的密碼

要求密碼至少包含一個(gè)大寫字母、一個(gè)小寫字母、一位數(shù)字和一個(gè)特殊字符,并且密碼總長(zhǎng)度至少為8個(gè)字符。密碼和-p不能有空格隔開(kāi)

mysql> alter user root@localhost identified by 'Admin123!';

9,退出數(shù)據(jù)庫(kù)

mysql> exit

10,使用新設(shè)置的密碼登錄數(shù)據(jù)庫(kù)

[root@localhost yum.repos.d]# mysql -uroot -pAdmin123!

11,查看數(shù)據(jù)庫(kù)

mysql> show databases;

卸載數(shù)據(jù)庫(kù)軟件

1,使用命令卸載mysql軟件

[root@localhost yum.repos.d]# dnf remove mysql-server -y

2,查看是否卸載干凈

[root@localhost yum.repos.d]# rpm -qa | grep mysql

3,把沒(méi)卸載干凈的卸載完

[root@localhost yum.repos.d]# rpm -e mysql80-community-release-el9-1.noarch

4,清除日志文件

[root@localhost yum.repos.d]# rm -rf /var/lib/mysql /var/log/mysqld.log

二,本地安裝

1,新建一個(gè)mysql目錄,并切換到mydql目錄下

[root@localhost yum.repos.d]# mkdir mysql
 
[root@localhost yum.repos.d]# cd mysql

2,下載rpm包

?[root@localhost mysql]# wget  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar?

3,下載完成后是一個(gè)tar包,需要解包

[root@localhost mysql]# tar xf mysql-8.0.32-1.el9.x86_64.rpm-bundle.tar

4,解包后會(huì)生成許多rpm包

[root@localhost mysql]# ll

5,安裝mysql時(shí)會(huì)用到一些依賴包;安裝依賴包(包之間有依賴,一起安裝)

[root@localhost mysql]# rpm -ivh mysql-community-server-8.0.32-1.el9.x86_64.rpm  mysql-community-client-8.0.32-1.el9.x86_64.rpm mysql-community-common-8.0.32-1.el9.x86_64.rpm mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm  mysql-community-libs-8.0.32-1.el9.x86_64.rpm

6,啟動(dòng)mysqld服務(wù)

[root@localhost mysql]# systemctl start mysqld

7,查看服務(wù)狀態(tài)

[root@localhost mysql]# systemctl status mysqld

8,查看數(shù)據(jù)庫(kù)root的臨時(shí)密碼

[root@localhost yum.repos.d]# grep 'temporary password' /var/log/mysqld.log

9,使用臨時(shí)密碼登錄數(shù)據(jù)庫(kù)

[root@localhost mysql]# mysql -uroot -p'Lf+lN:jqO3;w'

10,設(shè)置新密碼

要求密碼至少包含一個(gè)大寫字母、一個(gè)小寫字母、一位數(shù)字和一個(gè)特殊字符,并且密碼總長(zhǎng)度至少為8個(gè)字符。

密碼和-p不能有空格隔開(kāi),用單引號(hào)引起來(lái)

mysql> alter user root@localhost identified by 'Admin123!';

11,退出數(shù)據(jù)庫(kù)

mysql> exit

12,使用新密碼登錄

[root@localhost mysql]# mysql -uroot -p'Admin123!';

13,查看數(shù)據(jù)庫(kù)

mysql> show databases;

卸載軟件

1,卸載包,卸載時(shí)不需要加包名

[root@localhost mysql]# rpm -evh mysql-community-client-plugins mysql-community-common mysql-community-libs mysql-community-client mysql-community-icu-data-files mysql-community-server

2,清除日志文件

[root@localhost yum.repos.d]# rm -rf /var/lib/mysql /var/log/mysqld.log

三,容器安裝

1,如果之前安裝過(guò)容器相關(guān)的包;卸載已有的包

[root@localhost mysql]# rm -rf /var/lib/mysql /var/log/mysqld.log
[root@localhost mysql]# yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

2,裝容器所需要的依賴包

[root@localhost mysql]# dnf install -y yum-utils device-mapper-persistent-data lvm2

3,需要寫容器的倉(cāng)庫(kù);添加阿里云的倉(cāng)庫(kù)

?
[root@localhost mysql]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
?

4,查看目錄/etc/yum.repos.d;會(huì)發(fā)現(xiàn)多了一個(gè)docker-ce.repo

[root@localhost mysql]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ll

5,查看已經(jīng)安裝的倉(cāng)庫(kù)id和倉(cāng)庫(kù)名稱,會(huì)發(fā)現(xiàn)多了1個(gè)倉(cāng)庫(kù)

[root@localhost yum.repos.d]# yum repolist

6,修改下載docker的網(wǎng)站,改為阿里云的(國(guó)內(nèi)的比較快)

[root@localhost yum.repos.d]# sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo

7,安裝docker--ce時(shí)需要替換沖突軟件包

[root@localhost yum.repos.d]# dnf install docker-ce --allowerasing -y

8,啟動(dòng)docker服務(wù)

[root@localhost yum.repos.d]# systemctl start docker

9,查看docker服務(wù)狀態(tài)

[root@localhost yum.repos.d]# systemctl status docker

10,測(cè)試能否正常使用

[root@localhost yum.repos.d]# docker run --name mysqltest -e MYSQL_ROOT_PASSWORD=123456 -d mysql

[root@localhost yum.repos.d]# docker ps

11,進(jìn)到容器里面操作數(shù)據(jù)庫(kù)

[root@localhost yum.repos.d]#  docker exec -it mysqltest /bin/bash
bash-4.4# mysql -uroot -p123456 

12,查看數(shù)據(jù)庫(kù)

mysql> show databases;

四,源碼安裝 

1,下載源碼包

?
[root@localhost yum.repos.d]# wget  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.32.tar.gz
--2023-02-10 09:14:15--  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.32.tar.gz
Resolving cdn.mysql.com (cdn.mysql.com)... 23.36.48.238
Connecting to cdn.mysql.com (cdn.mysql.com)|23.36.48.238|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 436207624 (416M) [application/x-tar-gz]
Saving to: ‘mysql-boost-8.0.32.tar.gz.1'
mysql-boost-8.0.32.tar.gz.1    100%[===================================================>] 416.00M  5.33MB/s    in 74s    
2023-02-10 09:15:30 (5.63 MB/s) - ‘mysql-boost-8.0.32.tar.gz.1' saved [436207624/436207624]
?

2,添加用戶和組:

[root@localhost yum.repos.d]# groupadd mysql
groupadd: group 'mysql' already exists
[root@localhost yum.repos.d]#  useradd -r -g mysql -s /bin/false mysql
useradd: user 'mysql' already exists
[root@localhost yum.repos.d]#

3,解壓包:

[root@localhost mysql-source]# tar xvf mysql-boost-8.0.32.tar.gz.1

4,解壓完成后會(huì)生成一堆文件在mysql-8.0.32目錄下:

[root@localhost mysql-source]# ll
total 425992
drwxr-xr-x. 32 7161 31415      4096 Dec 16 23:59 mysql-8.0.32
-rw-r--r--.  1 root root  436207624 Dec 16 23:01 mysql-boost-8.0.32.tar.gz.1

5,切換到目錄mysql-8.0.32下,可以查看到源碼包里面所有的東西

[root@localhost mysql-source]# cd mysql-8.0.32/
[root@localhost mysql-8.0.32]# ls
boost           configure.cmake    include              libservices    packaging          share          testclients
client          Docs               INSTALL              LICENSE        plugin             sql            unittest
cmake           Doxyfile-ignored   libbinlogevents      man            README             sql-common     utilities
CMakeLists.txt  Doxyfile.in        libbinlogstandalone  mysql-test     router             storage        vio
components      doxygen_resources  libchangestreams     MYSQL_VERSION  run_doxygen.cmake  strings
config.h.cmake  extra              libmysql             mysys          scripts            support-files

6,安裝編譯器

[root@localhost mysql-8.0.32]# yum install gcc gcc-c++ cmake -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.
MySQL Tools Community                                                                      1.3 kB/s | 2.6 kB     00:01   
baseos                                                                                     2.7 MB/s | 2.7 kB     00:00   
AppStream                                                                                  3.1 MB/s | 3.2 kB     00:00   
Dependencies resolved.

7,安裝編譯過(guò)程中可能需要的一些庫(kù):

[root@localhost mysql-8.0.32]# yum install   cmake gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-binutils openssl-devel ncurses-devel libtirpc rpcgen git  -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered with an entitlement server. You can use subscription-manager to register.

8,安裝包:

?
[root@localhost mysql-8.0.32]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/CRB/x86_64/os/Packages/libtirpc-devel-1.3.3-0.el9.x86_64.rpm
Retrieving https://mirrors.tuna.tsinghua.edu.cn/centos-stream/9-stream/CRB/x86_64/os/Packages/libtirpc-devel-1.3.3-0.el9.x86_64.rpm
warning: /var/tmp/rpm-tmp.xz3G2s: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:libtirpc-devel-1.3.3-0.el9       ################################# [100%]
?

9,創(chuàng)建一個(gè)編譯的目錄:

[root@localhost mysql-8.0.32]# mkdir bld

[root@localhost mysql-8.0.32]# cd bld

10,編譯(注意路徑):

[root@localhost bld]# cmake .. -DWITH_BOOST=../boost/boost_1_77_0/
-- Running cmake version 3.20.2
-- Found Git: /usr/bin/git (found version "2.31.1")

11,編譯

[root@localhost bld]# make

12,安裝:把編譯的文件拷貝到對(duì)應(yīng)的系統(tǒng)下的目錄

[root@localhost bld]# make install

13,切換到目錄/usr/local/mysql下

[root@localhost bld]# cd /usr/local/mysql

14,創(chuàng)建目錄 mysql-files 用來(lái)存儲(chǔ)mysql的一些數(shù)據(jù)

[root@localhost mysql]# mkdir mysql-files

15,修改此目錄的所屬者與所屬組以及此目錄的權(quán)限,防止mysql讀不到,

[root@localhost mysql]# chown mysql:mysql mysql-files
[root@localhost mysql]# chmod 750 mysql-files

16,初始化數(shù)據(jù)庫(kù)

[root@localhost mysql]# ./bin/mysqld --initialize --user=mysql

17,開(kāi)啟lsl的加密

[root@localhost mysql]# ./bin/mysql_ssl_rsa_setup

18,獲取臨時(shí)密碼

[root@localhost mysql]#  grep 'temporary password' /var/log/mysqld.log
2023-02-07T13:07:17.842453Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *2D):irrJ_!_

19,使用新密碼登錄

[root@localhost mysql]# mysql -uroot -p'Admin123!';

20,查看數(shù)據(jù)庫(kù)

mysql> show databases;

總結(jié) 

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

相關(guān)文章

  • 查找MySQL中查詢慢的SQL語(yǔ)句方法

    查找MySQL中查詢慢的SQL語(yǔ)句方法

    這篇文章主要介紹了查找MySQL中查詢慢的SQL語(yǔ)句方法,需要的朋友可以參考下
    2017-05-05
  • MySQL快速插入大量數(shù)據(jù)的解決方案和代碼示例

    MySQL快速插入大量數(shù)據(jù)的解決方案和代碼示例

    在這篇博客中,我們將深入探討如何高效插入大量數(shù)據(jù)到MySQL數(shù)據(jù)庫(kù),無(wú)論你是數(shù)據(jù)庫(kù)新手還是經(jīng)驗(yàn)豐富的開(kāi)發(fā)者,這篇文章都將為你提供實(shí)用的解決方案和代碼示例,幫助你解決插入3萬(wàn)條數(shù)據(jù)需要20多秒的問(wèn)題,需要的朋友可以參考下
    2024-08-08
  • MySQL中安裝樣本數(shù)據(jù)庫(kù)Sakila過(guò)程分享

    MySQL中安裝樣本數(shù)據(jù)庫(kù)Sakila過(guò)程分享

    這篇文章主要介紹了MySQL中安裝樣本數(shù)據(jù)庫(kù)Sakila過(guò)程分享,Sakila數(shù)據(jù)庫(kù)主要用來(lái)做一些基本的操作以及壓力測(cè)試等,需要的朋友可以參考下
    2014-10-10
  • Win10環(huán)境下安裝Mysql5.7.23問(wèn)題及遇到的坑

    Win10環(huán)境下安裝Mysql5.7.23問(wèn)題及遇到的坑

    這篇文章主要介紹了Win10環(huán)境下安裝Mysql5.7.23問(wèn)題及遇到的坑,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-11-11
  • 如何將mysql存儲(chǔ)位置遷移到一塊新的磁盤上

    如何將mysql存儲(chǔ)位置遷移到一塊新的磁盤上

    這篇文章主要介紹了如何將mysql存儲(chǔ)位置遷移到一塊新的磁盤上,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-12-12
  • MySQL修改表結(jié)構(gòu)操作命令總結(jié)

    MySQL修改表結(jié)構(gòu)操作命令總結(jié)

    這篇文章主要介紹了MySQL修改表結(jié)構(gòu)操作命令總結(jié),包含如刪除列、添加列、修改列、添加主鍵、刪除主鍵、添加唯一索引、添加普通索引等內(nèi)容,需要的朋友可以參考下
    2014-12-12
  • MySQL存儲(chǔ)IP地址的方法

    MySQL存儲(chǔ)IP地址的方法

    本文介紹了MySQL存儲(chǔ)IP地址的方法其目的就是最大限度的優(yōu)化性能,需要的朋友可以參考下
    2015-07-07
  • MySQL建表(create?table)命令解讀

    MySQL建表(create?table)命令解讀

    這篇文章主要介紹了MySQL建表(create?table)命令的使用,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • MySQL數(shù)據(jù)庫(kù)中遇到no?database?selected問(wèn)題解決辦法

    MySQL數(shù)據(jù)庫(kù)中遇到no?database?selected問(wèn)題解決辦法

    這篇文章主要給大家介紹了關(guān)于MySQL數(shù)據(jù)庫(kù)中遇到no?database?selected問(wèn)題的解決辦法,這是MySQL數(shù)據(jù)庫(kù)的錯(cuò)誤提示,意思是沒(méi)有選擇數(shù)據(jù)庫(kù),在使用MySQL命令行操作時(shí)需要先選擇要操作的數(shù)據(jù)庫(kù),否則就會(huì)出現(xiàn)這個(gè)錯(cuò)誤,需要的朋友可以參考下
    2024-03-03
  • MySQL中通過(guò)SQL語(yǔ)句刪除重復(fù)記錄并且只保留一條記錄

    MySQL中通過(guò)SQL語(yǔ)句刪除重復(fù)記錄并且只保留一條記錄

    本文主要介紹了MySQL中通過(guò)SQL語(yǔ)句刪除重復(fù)記錄并且只保留一條記錄,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01

最新評(píng)論