第一步、下載壓縮套件
下載社群版的 MySQL,根據需求下載對應版本,其中有最小安裝版本。
第二步,解壓縮壓縮包,並複製到安裝目錄
#進入到壓縮包所在的資料夾,解壓縮分成兩次,第一次解壓縮xz 文件,第二次解壓縮tar 文件。
xz -dv mysql-8.0.32-linux-glibc2.12-x86_64.tar.xz tar -xvf mysql-8.0.32-linux-glibc2.12-x86_64.tar
複製解壓縮後的檔案到要安裝的目錄,我要把MySQL 安裝到/usr/local/mysql,所以,執行以下指令,把解壓縮後的檔案複製過去
sudo cp -r mysql-8.0.32-linux-glibc2.12-x86_64/* /usr/local/mysql
這裡需要修改以下安裝目錄的權限,由於我們使用mysql 用戶運行資料庫,所以,要把安裝目錄的擁有者改為mysql,如果系統沒有,需要添加mysql 用戶及分組,我們只使用mysql 運行程序,所以指定了mysql 禁止登錄,增加安全性
sudo groupadd mysql sudo useradd mysql -s /usr/sbin/nologin -g mysql
修改安裝目錄的擁有者為mysql
chown -R mysql:mysql /usr/local/mysql/
第三步、編輯設定檔
編輯設定文件,我們把設定檔放到/etc/my.cnf
設定如下:
[client] port=3306 # 端口 # mysqlx_port=33060 socket=/var/lib/mysql/mysql.sock # mysqlx_socket=/var/lib/mysqlx.sock [mysqld] # skip-grant-tables # mysql安装目录 basedir=/usr/local/mysql/ # mysql数据库目录 datadir=/var/lib/mysql/data/ port=3306 innodb_file_per_table=1 character-set-server=UTF8MB4 mysqlx_port=33060 socket = /var/lib/mysql/mysql.sock # mysqlx_socket=/var/lib/mysql/mysqlx.sock [mysqld_safe] # 错误日志 log-error=/var/log/mysql/error.log # pid文件 pid-file=/usr/local/mysql/mysqld.pid tmpdir=/var/lib/mysql/mysql
第四步、確定一些相關的目錄
編輯檔案support-files/mysql. server,修改裡面的相關目錄
安裝目錄basedir=/usr/local/mysql
設定目錄/etc/my.cnf
資料庫檔案目錄datadir=/var /lib/mysql/data/
pid 檔案pid-file=/usr/local/mysql/mysqld.pid
第五步、初始化資料庫
初始化資料庫,注意,初始化成功後,終端機會顯示root 帳號密碼,一定要儲存下來
sudo ./bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --initialize
第六步、啟動資料庫,連線並修改root 密碼
sudo ./bin/mysqld --defaults-file=/etc/my.cnf --user=mysql
連線資料庫,修改root 密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码';
第六步、守護MySQL 程序
建立守護程序,保證在伺服器重新啟動後能夠自動啟動,執行
sudo vim /etc/systemd/system/mysql.service
內容如下,其中User 和Group 為mysql
[Unit] Description=MySQL Server Documentation=man:mysqld(8) After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/etc/my.cnf LimitNOFILE = 5000 #Restart=on-failure #RestartPreventExitStatus=1 #PrivateTmp=false
# 使能 sudo systemctl enable mysql.service # 启动 sudo systemctl start mysql.service # 查看状态 sudo systemctl status mysql.service
第七步、驗證
重啟伺服器驗證mysql 程序是否啟動
以上是Centos7.9安裝MySQL8.0.32的方法是什麼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

todropaviewInmySQL,使用“ dropviewifexistsview_name;” andTomodifyAview,使用“ createOrreplaceViewViewViewview_nameAsSelect ...”。 whendroppingaview,asew dectivectenciesanduse和showcreateateviewViewview_name;“ tounderStanditSsstructure.whenModifying

mySqlViewScaneFectectialized unizedesignpatternslikeadapter,Decorator,Factory,andObserver.1)adapterPatternadaptSdataForomDifferentTablesIntoAunifiendView.2)decoratorPatternenhancateDataWithCalcalcualdCalcalculenfields.3)fieldfields.3)

查看InMysqlareBeneForsImplifyingComplexqueries,增強安全性,確保dataConsistency,andOptimizingPerformance.1)他們simimplifycomplexqueriesbleiesbyEncapsbyEnculatingThemintoreusableviews.2)viewsEnenenhancesecuritybyControllityByControllingDataAcces.3)

toCreateAsimpleViewInmySQL,USEthecReateaTeviewStatement.1)defitEtheetEtheTeViewWithCreatEaTeviewView_nameas.2)指定usethectstatementTorivedesireddata.3)usethectStatementTorivedesireddata.3)usetheviewlikeatlikeatlikeatlikeatlikeatlikeatable.views.viewssimplplifefifydataaccessandenenanceberity but consisterfort,butconserfort,consoncontorfinft

1)foralocaluser:createUser'localuser'@'@'localhost'Indidendify'securepassword'; 2)foraremoteuser:creationuser's creationuser'Remoteer'Remoteer'Remoteer'Remoteer'Remoteer'Remoteer'Remoteer'Remoteer'Rocaluser'@'localhost'Indidendify'seceledify'Securepassword'; 2)

mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

WebStorm Mac版
好用的JavaScript開發工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

MinGW - Minimalist GNU for Windows
這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

SublimeText3漢化版
中文版,非常好用

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)