亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 數據庫 > MySQL > 正文

CentOS 7.4 64位安裝配置MySQL8.0的詳細步驟

2024-07-25 19:09:09
字體:
來源:轉載
供稿:網友

第一步:獲取mysql YUM源

進入mysql官網獲取RPM包下載地址

https://dev.mysql.com/downloads/repo/yum/

CentOS,安裝,配置,MySQL8.0

點擊下載

CentOS,安裝,配置,MySQL8.0

獲取到下載鏈接:

https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm

--------------------------------------------------------------------------------

第二步:下載和安裝mysql源

•進入mysql文件夾,沒有的自行創建

[root@VM_0_10_centos /]# cd /usr/local/mysql/[root@VM_0_10_centos mysql]#

•下載源安裝包

[root@VM_0_10_centos mysql]# wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm--2018-08-04 10:29:39-- https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpmResolving repo.mysql.com (repo.mysql.com)... 23.219.33.198Connecting to repo.mysql.com (repo.mysql.com)|23.219.33.198|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 25820 (25K) [application/x-redhat-package-manager]Saving to: ‘mysql80-community-release-el7-1.noarch.rpm'100%[==========================================================================>] 25,820 112KB/s in 0.2s 2018-08-04 10:29:40 (112 KB/s) - ‘mysql80-community-release-el7-1.noarch.rpm' saved [25820/25820][root@VM_0_10_centos mysql]# lltotal 28-rw-r--r-- 1 root root 25820 Apr 18 13:24 mysql80-community-release-el7-1.noarch.rpm[root@VM_0_10_centos mysql]#

•安裝mysql源

[root@VM_0_10_centos mysql]# yum -y localinstall mysql80-community-release-el7-1.noarch.rpm

第三步:在線安裝MySQL

[root@VM_0_10_centos mysql]# yum -y install mysql-community-server

下載東西比較多,等幾分鐘。

第四步:啟動Mysql服務

[root@VM_0_10_centos mysql]# systemctl start mysqld

第五步:設置開機啟動

[root@VM_0_10_centos mysql]# systemctl enable mysqld[root@VM_0_10_centos mysql]# systemctl daemon-reload

第六步:修改root本地登錄密碼

mysql安裝完成之后,在/var/log/mysqld.log文件中給root生成了一個臨時的默認密碼。用grep命令搜一下

[root@VM_0_10_centos mysql]# grep "A temporary password is generated for root@localhost" /var/log/mysqld.log 2018-08-02T02:19:55.829527Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: !J:KUwU9y0ZR2018-08-02T04:49:34.979689Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: pw</s9,Wivm22018-08-04T02:40:46.781768Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: nNyK,Y)Wd0-G[root@VM_0_10_centos mysql]#

這里有三條搜索結果,因為我重復裝了3次MySQL,如果第一次安裝是只會有一條的。

 直接拿到臨時默認密碼 : nNyK,Y)Wd0-G

•登錄MySQL

[root@VM_0_10_centos mysql]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or /g.Your MySQL connection id is 8Server version: 8.0.12Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql>

•更改root賬戶臨時密碼

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Pwd123@easyoh.net';Query OK, 0 rows affected (0.03 sec)mysql>

Pwd123@easyoh.net 請替換成你自己的密碼。

(備注 mysql8.0默認密碼策略要求密碼必須是大小寫字母數字特殊字母的組合,至少8位)

第七步:創建新用戶、授權、遠程登錄(不要直接使用root賬戶登錄)

•創建easyoh-mp用戶并且授權遠程登錄

mysql> CREATE USER 'easyoh-mp'@'%' IDENTIFIED BY 'Pwd123@easyoh.net';Query OK, 0 rows affected (0.04 sec)mysql> GRANT ALL ON *.* TO 'easyoh-mp'@'%';Query OK, 0 rows affected (0.03 sec)mysql>

•在sqlyog客戶端用easyoh-mp賬戶登錄(其他客戶端也可以,隨意)

CentOS,安裝,配置,MySQL8.0

發現會報plugin caching_sha2_password錯誤。這是因為MySQL8.0密碼策略默認為caching_sha2_password。與5.7有所不同。

•進入MySQL數據庫查詢user表信息

mysql> use mysql;Database changedmysql> select user,host,plugin from user;+------------------+-----------+-----------------------+| user  | host | plugin  |+------------------+-----------+-----------------------+| easyoh-mp | %  | caching_sha2_password || mysql.infoschema | localhost | caching_sha2_password || mysql.session | localhost | caching_sha2_password || mysql.sys | localhost | caching_sha2_password || root  | localhost | caching_sha2_password |+------------------+-----------+-----------------------+5 rows in set (0.00 sec)mysql>

發現確實是caching_sha2_password

•依次執行下面語句

mysql> ALTER USER 'easyoh-mp'@'%' IDENTIFIED BY 'Pwd123@easyoh.net' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.04 sec)mysql> ALTER USER 'easyoh-mp'@'%' IDENTIFIED WITH mysql_native_password BY 'Pwd123@easyoh.net'; Query OK, 0 rows affected (0.05 sec)mysql> FLUSH PRIVILEGES;Query OK, 0 rows affected (0.01 sec)mysql>

再次登錄就可以登錄成功了。

第8步:編碼

mysql> show variables like '%character%';+--------------------------+--------------------------------+| Variable_name  | Value    |+--------------------------+--------------------------------+| character_set_client | utf8mb4   || character_set_connection | utf8mb4   || character_set_database | utf8mb4   || character_set_filesystem | binary    || character_set_results | utf8mb4   || character_set_server | utf8mb4   || character_set_system | utf8    || character_sets_dir | /usr/share/mysql-8.0/charsets/ |+--------------------------+--------------------------------+8 rows in set (0.01 sec)mysql>

MySQL8.0默認就是utf8mb4編碼,無需更改。

OK 至此 Mysql安裝配置完畢;

全流程操作記錄

[root@VM_0_10_centos ~]# [root@VM_0_10_centos /]# cd /usr/local/mysql/[root@VM_0_10_centos mysql]# wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm--2018-08-04 10:29:39-- https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpmResolving repo.mysql.com (repo.mysql.com)... 23.219.33.198Connecting to repo.mysql.com (repo.mysql.com)|23.219.33.198|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 25820 (25K) [application/x-redhat-package-manager]Saving to: ‘mysql80-community-release-el7-1.noarch.rpm'100%[==========================================================================>] 25,820 112KB/s in 0.2s 2018-08-04 10:29:40 (112 KB/s) - ‘mysql80-community-release-el7-1.noarch.rpm' saved [25820/25820][root@VM_0_10_centos mysql]# lltotal 28-rw-r--r-- 1 root root 25820 Apr 18 13:24 mysql80-community-release-el7-1.noarch.rpm[root@VM_0_10_centos mysql]# yum -y localinstall mysql80-community-release-el7-1.noarch.rpm Loaded plugins: fastestmirror, langpacksExamining mysql80-community-release-el7-1.noarch.rpm: mysql80-community-release-el7-1.noarchMarking mysql80-community-release-el7-1.noarch.rpm to be installedResolving Dependencies--> Running transaction check---> Package mysql80-community-release.noarch 0:el7-1 will be installed--> Finished Dependency ResolutionDependencies Resolved================================================================================================================================================================================================================= Package       Arch     Version    Repository        Size=================================================================================================================================================================================================================Installing: mysql80-community-release    noarch    el7-1     /mysql80-community-release-el7-1.noarch    31 kTransaction Summary=================================================================================================================================================================================================================Install 1 PackageTotal size: 31 kInstalled size: 31 kDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transactionWarning: RPMDB altered outside of yum. Installing : mysql80-community-release-el7-1.noarch                   1/1  Verifying : mysql80-community-release-el7-1.noarch                   1/1 Installed: mysql80-community-release.noarch 0:el7-1                     Complete![root@VM_0_10_centos mysql]# yum -y install mysql-community-serverLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfileepel                         12641/12641Resolving Dependencies--> Running transaction check---> Package mysql-community-server.x86_64 0:8.0.12-1.el7 will be installed--> Processing Dependency: mysql-community-common(x86-64) = 8.0.12-1.el7 for package: mysql-community-server-8.0.12-1.el7.x86_64--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.0 for package: mysql-community-server-8.0.12-1.el7.x86_64--> Running transaction check---> Package mysql-community-client.x86_64 0:8.0.12-1.el7 will be installed--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.0 for package: mysql-community-client-8.0.12-1.el7.x86_64---> Package mysql-community-common.x86_64 0:8.0.12-1.el7 will be installed--> Running transaction check---> Package mysql-community-libs.x86_64 0:8.0.12-1.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved================================================================================================================================================================================================================= Package       Arch     Version      Repository      Size=================================================================================================================================================================================================================Installing: mysql-community-server     x86_64     8.0.12-1.el7     mysql80-community     349 MInstalling for dependencies: mysql-community-client     x86_64     8.0.12-1.el7     mysql80-community     26 M mysql-community-common     x86_64     8.0.12-1.el7     mysql80-community     541 k mysql-community-libs     x86_64     8.0.12-1.el7     mysql80-community     2.2 MTransaction Summary=================================================================================================================================================================================================================Install 1 Package (+3 Dependent packages)Total download size: 377 MInstalled size: 1.7 GDownloading packages:(1/4): mysql-community-common-8.0.12-1.el7.x86_64.rpm                 | 541 kB 00:00:05 (2/4): mysql-community-client-8.0.12-1.el7.x86_64.rpm                 | 26 MB 00:00:12 (3/4): mysql-community-server-8.0.12-1.el7.x86_64.rpm                 | 349 MB 00:02:26 (4/4): mysql-community-libs-8.0.12-1.el7.x86_64.rpm                 | 2.2 MB 00:03:37 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                      1.7 MB/s | 377 MB 00:03:43 Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : mysql-community-common-8.0.12-1.el7.x86_64                   1/4  Installing : mysql-community-libs-8.0.12-1.el7.x86_64                   2/4  Installing : mysql-community-client-8.0.12-1.el7.x86_64                   3/4  Installing : mysql-community-server-8.0.12-1.el7.x86_64                   4/4  Verifying : mysql-community-common-8.0.12-1.el7.x86_64                   1/4  Verifying : mysql-community-libs-8.0.12-1.el7.x86_64                   2/4  Verifying : mysql-community-client-8.0.12-1.el7.x86_64                   3/4  Verifying : mysql-community-server-8.0.12-1.el7.x86_64                   4/4 Installed: mysql-community-server.x86_64 0:8.0.12-1.el7                     Dependency Installed: mysql-community-client.x86_64 0:8.0.12-1.el7    mysql-community-common.x86_64 0:8.0.12-1.el7    mysql-community-libs.x86_64 0:8.0.12-1.el7    Complete![root@VM_0_10_centos mysql]# systemctl start mysqld[root@VM_0_10_centos mysql]# systemctl enable mysqld[root@VM_0_10_centos mysql]# systemctl daemon-reload[root@VM_0_10_centos mysql]# grep "A temporary password is generated for root@localhost" /var/log/mysqld.log 2018-08-02T02:19:55.829527Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: !J:KUwU9y0ZR2018-08-02T04:49:34.979689Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: pw</s9,Wivm22018-08-04T02:40:46.781768Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: nNyK,Y)Wd0-G[root@VM_0_10_centos mysql]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or /g.Your MySQL connection id is 8Server version: 8.0.12Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Pwd123@easyoh.net';Query OK, 0 rows affected (0.03 sec)mysql> CREATE USER 'easyoh-mp'@'%' IDENTIFIED BY 'Pwd123@easyoh.net';Query OK, 0 rows affected (0.04 sec)mysql> GRANT ALL ON *.* TO 'easyoh-mp'@'%';Query OK, 0 rows affected (0.03 sec)mysql> use mysql;Database changedmysql> select user,host,plugin from user;+------------------+-----------+-----------------------+| user  | host | plugin  |+------------------+-----------+-----------------------+| easyoh-mp | %  | caching_sha2_password || mysql.infoschema | localhost | caching_sha2_password || mysql.session | localhost | caching_sha2_password || mysql.sys | localhost | caching_sha2_password || root  | localhost | caching_sha2_password |+------------------+-----------+-----------------------+5 rows in set (0.00 sec)mysql> ALTER USER 'easyoh-mp'@'%' IDENTIFIED BY 'Pwd123@easyoh.net' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.04 sec)mysql> ALTER USER 'easyoh-mp'@'%' IDENTIFIED WITH mysql_native_password BY 'Pwd123@easyoh.net'; Query OK, 0 rows affected (0.05 sec)mysql> FLUSH PRIVILEGES;Query OK, 0 rows affected (0.01 sec)mysql> show variables like '%character%';+--------------------------+--------------------------------+| Variable_name  | Value    |+--------------------------+--------------------------------+| character_set_client | utf8mb4   || character_set_connection | utf8mb4   || character_set_database | utf8mb4   || character_set_filesystem | binary    || character_set_results | utf8mb4   || character_set_server | utf8mb4   || character_set_system | utf8    || character_sets_dir | /usr/share/mysql-8.0/charsets/ |+--------------------------+--------------------------------+8 rows in set (0.01 sec)

 這里有個問題,新密碼設置的時候如果設置的過于簡單會報錯:

  原因是因為MySQL有密碼設置的規范,具體是與validate_password_policy的值有關:

CentOS,安裝,配置,MySQL8.0

  MySQL完整的初始密碼規則可以通過如下命令查看:

mysql> SHOW VARIABLES LIKE 'validate_password%';+--------------------------------------+-------+| Variable_name   | Value |+--------------------------------------+-------+| validate_password_check_user_name | OFF || validate_password_dictionary_file | || validate_password_length  | 4 || validate_password_mixed_case_count | 1 || validate_password_number_count | 1 || validate_password_policy  | LOW || validate_password_special_char_count | 1 |+--------------------------------------+-------+7 rows in set (0.01 sec)

  密碼的長度是由validate_password_length決定的,而validate_password_length的計算公式是:

validate_password_length = validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)

我的是已經修改過的,初始情況下第一個的值是ON,validate_password_length是8??梢酝ㄟ^如下命令修改:

mysql> set global validate_password_policy=0;mysql> set global validate_password_length=1;

總結

以上所述是小編給大家介紹的CentOS 7.4 64位安裝配置MySQL8.0的詳細步驟,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對VeVb武林網網站的支持!


注:相關教程知識閱讀請移步到MYSQL教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲另类欧美自拍| 性夜试看影院91社区| 久久99青青精品免费观看| 国产精品白丝av嫩草影院| 国产精品成人品| 国产精品免费小视频| 欧美视频在线观看免费| 精品中文字幕在线观看| 日韩影视在线观看| 欧美中文在线观看国产| 亚洲成人三级在线| 日韩免费视频在线观看| 国产精品黄页免费高清在线观看| 日韩欧美高清视频| 欧美www视频在线观看| 97视频在线观看视频免费视频| 97视频免费在线观看| 欧美国产精品人人做人人爱| 亚洲精品电影网在线观看| 蜜臀久久99精品久久久无需会员| 欧美一级大片在线免费观看| 亚洲美女又黄又爽在线观看| 91av在线播放| 伊人成人开心激情综合网| 欧美激情视频一区二区三区不卡| 亚洲电影成人av99爱色| 日韩av在线免费| 欧美在线视频网| 日韩亚洲第一页| 一道本无吗dⅴd在线播放一区| 亚洲成人aaa| 亚洲精品成人久久电影| 亚洲美女激情视频| 国内精品久久久久久影视8| 欧美激情免费观看| 国产精品黄色av| 国内精品久久久久久| 色妞一区二区三区| 欧美亚洲午夜视频在线观看| 亚洲在线观看视频| 97视频在线看| 欧美性猛交99久久久久99按摩| 国产精品入口尤物| 亚洲综合中文字幕68页| 国产精品久久久久久久av电影| 一个人www欧美| 成人免费在线视频网站| 欧美丝袜第一区| 日韩成人av在线播放| 日韩在线免费av| 日韩在线视频观看正片免费网站| 久久精品99久久久香蕉| 日韩经典中文字幕| 欧美成人亚洲成人日韩成人| 一区二区三区亚洲| 91九色精品视频| 欧美日韩中国免费专区在线看| 精品国产欧美一区二区五十路| 欧美一区二区三区……| 97久久国产精品| 国内精品久久久久伊人av| 色综合久久88色综合天天看泰| 高潮白浆女日韩av免费看| 久久韩国免费视频| 日韩av理论片| 中文字幕日韩在线观看| 日韩欧美在线视频日韩欧美在线视频| 国产玖玖精品视频| 久久久久久国产精品| 中文字幕亚洲一区二区三区| 亚洲偷熟乱区亚洲香蕉av| 黄网动漫久久久| 永久免费精品影视网站| 日韩免费av一区二区| 日韩国产精品视频| 亚洲国产精品网站| 亚洲理论电影网| 亚洲mm色国产网站| 久久久久久国产精品久久| 国产精品xxx视频| 91精品久久久久久久| 欧美日韩国产一区中文午夜| 国产精品一区二区三区成人| 国外色69视频在线观看| 欧美日韩亚洲精品内裤| 欧洲精品在线视频| 精品久久久久久久久久久久久久| 国产日韩在线看片| 4438全国成人免费| 精品欧美国产一区二区三区| 日韩欧美国产成人| 欧美日韩久久久久| 91久久精品久久国产性色也91| 精品香蕉在线观看视频一| 欧美亚洲日本网站| 欧美—级a级欧美特级ar全黄| 91亚洲精品久久久久久久久久久久| 亚洲人成77777在线观看网| 欧洲日本亚洲国产区| 国产日韩欧美黄色| 日韩av网址在线观看| 亚洲欧美日本伦理| 日韩视频永久免费观看| 亚洲一区二区日本| 国产精品亚洲综合天堂夜夜| 97精品一区二区视频在线观看| 日韩在线免费av| 亚洲三级黄色在线观看| 欧美另类在线播放| 欧美猛交免费看| 久久五月天色综合| 一区二区三区视频观看| 中文字幕欧美精品日韩中文字幕| 国产伦精品一区二区三区精品视频| 国产亚洲精品91在线| 久久精品99国产精品酒店日本| 欧美午夜性色大片在线观看| 日韩一区视频在线| 色哟哟亚洲精品一区二区| 在线电影av不卡网址| 91久久精品国产91性色| 日韩精品在线观看一区| 欧美激情一区二区三区成人| 九九久久综合网站| 国产精品视频色| 色偷偷88888欧美精品久久久| 91亚洲精品在线| 亚洲天堂视频在线观看| 欧美日韩在线第一页| 欧美精品在线第一页| 日韩电影免费在线观看| 欧美影院成年免费版| 欧美裸体男粗大视频在线观看| 午夜伦理精品一区| 色yeye香蕉凹凸一区二区av| 欧美野外wwwxxx| 欧美大奶子在线| 国产美女精彩久久| 亚洲欧美激情一区| 午夜精品一区二区三区在线| 亚洲xxxxx| 亚洲精品成人av| 97精品在线观看| 亚洲高清不卡av| 欧美性xxxx在线播放| 欧美精品日韩www.p站| 日韩女在线观看| 国产欧美中文字幕| 91精品久久久久久久久中文字幕| 日av在线播放中文不卡| 日本亚洲精品在线观看| 日韩性生活视频| 亚洲精品黄网在线观看| 精品久久中文字幕久久av| 欧美日韩高清区| 一区二区三区亚洲| 欧美性生活大片免费观看网址| 91社影院在线观看| 久久久久久久色| 亚洲欧美国产一本综合首页| 久久视频在线看| xvideos国产精品| 亚洲精品电影网| 国产精品男女猛烈高潮激情|