最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2018年10月17日 10:11:43   作者:幕三少  
本文分步驟給大家介紹了CentOS 7.4 64位安裝配置MySQL8.0 的方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

第一步:獲取mysql YUM源

進(jìn)入mysql官網(wǎng)獲取RPM包下載地址

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

點(diǎn)擊下載

獲取到下載鏈接:

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

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

第二步:下載和安裝mysql源

•進(jìn)入mysql文件夾,沒有的自行創(chuàng)建

[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.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.219.33.198
Connecting to repo.mysql.com (repo.mysql.com)|23.219.33.198|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 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]# ll
total 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

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

第四步:啟動(dòng)Mysql服務(wù)

[root@VM_0_10_centos mysql]# systemctl start mysqld

第五步:設(shè)置開機(jī)啟動(dòng)

[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生成了一個(gè)臨時(shí)的默認(rèn)密碼。用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:KUwU9y0ZR
2018-08-02T04:49:34.979689Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: pw</s9,Wivm2
2018-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]#

這里有三條搜索結(jié)果,因?yàn)槲抑貜?fù)裝了3次MySQL,如果第一次安裝是只會(huì)有一條的。

 直接拿到臨時(shí)默認(rèn)密碼 : nNyK,Y)Wd0-G

•登錄MySQL

[root@VM_0_10_centos mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.12
Copyright (c) 2000, 2018, 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>

•更改root賬戶臨時(shí)密碼

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

Pwd123@easyoh.net 請?zhí)鎿Q成你自己的密碼。

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

第七步:創(chuàng)建新用戶、授權(quán)、遠(yuǎn)程登錄(不要直接使用root賬戶登錄)

•創(chuàng)建easyoh-mp用戶并且授權(quán)遠(yuǎn)程登錄

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賬戶登錄(其他客戶端也可以,隨意)

發(fā)現(xiàn)會(huì)報(bào)plugin caching_sha2_password錯(cuò)誤。這是因?yàn)镸ySQL8.0密碼策略默認(rèn)為caching_sha2_password。與5.7有所不同。

•進(jìn)入MySQL數(shù)據(jù)庫查詢user表信息

mysql> use mysql;
Database changed
mysql> 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>

發(fā)現(xiàn)確實(shí)是caching_sha2_password

•依次執(zhí)行下面語句

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默認(rèn)就是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.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.219.33.198
Connecting to repo.mysql.com (repo.mysql.com)|23.219.33.198|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 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]# ll
total 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, langpacks
Examining mysql80-community-release-el7-1.noarch.rpm: mysql80-community-release-el7-1.noarch
Marking mysql80-community-release-el7-1.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql80-community-release.noarch 0:el7-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================================
 Package       Arch     Version    Repository        Size
=================================================================================================================================================================================================================
Installing:
 mysql80-community-release    noarch    el7-1     /mysql80-community-release-el7-1.noarch    31 k
Transaction Summary
=================================================================================================================================================================================================================
Install 1 Package
Total size: 31 k
Installed size: 31 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: 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-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel                         12641/12641
Resolving 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 Resolution
Dependencies Resolved
=================================================================================================================================================================================================================
 Package       Arch     Version      Repository      Size
=================================================================================================================================================================================================================
Installing:
 mysql-community-server     x86_64     8.0.12-1.el7     mysql80-community     349 M
Installing 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 M
Transaction Summary
=================================================================================================================================================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 377 M
Installed size: 1.7 G
Downloading 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 check
Running transaction test
Transaction test succeeded
Running 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:KUwU9y0ZR
2018-08-02T04:49:34.979689Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: pw</s9,Wivm2
2018-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 -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.12
Copyright (c) 2000, 2018, 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> 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 changed
mysql> 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)

 這里有個(gè)問題,新密碼設(shè)置的時(shí)候如果設(shè)置的過于簡單會(huì)報(bào)錯(cuò):

  原因是因?yàn)镸ySQL有密碼設(shè)置的規(guī)范,具體是與validate_password_policy的值有關(guān):

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

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的計(jì)算公式是:

validate_password_length = validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)

我的是已經(jīng)修改過的,初始情況下第一個(gè)的值是ON,validate_password_length是8。可以通過如下命令修改:

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

總結(jié)

以上所述是小編給大家介紹的CentOS 7.4 64位安裝配置MySQL8.0的詳細(xì)步驟,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

  • Mysql中in和exists的區(qū)別?&?not?in、not?exists、left?join的相互轉(zhuǎn)換問題

    Mysql中in和exists的區(qū)別?&?not?in、not?exists、left?join的相互轉(zhuǎn)換問題

    這篇文章主要介紹了Mysql中in和exists的區(qū)別?&?not?in、not?exists、left?join的相互轉(zhuǎn)換,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-09-09
  • MySQL安裝配置方法教程

    MySQL安裝配置方法教程

    這篇文章主要為大家詳細(xì)分享了MySQL安裝配置方法教程,包括Linux/UNIX和Window系統(tǒng)上安裝MySQL的具體步驟,感興趣的朋友可以參考一下
    2016-05-05
  • 如何快速使用mysqlreplicate搭建MySQL主從

    如何快速使用mysqlreplicate搭建MySQL主從

    mysql-utilities工具集是一個(gè)集中了多種工具的合集,可以理解為是DBA的工具箱,本文介紹利用其中的mysqlreplicate工具來快速搭建MySQL主從環(huán)境。下面和小編一起來看看
    2019-05-05
  • MySQL Order By語法介紹

    MySQL Order By語法介紹

    今天在使用ORDER BY的過程中出現(xiàn)了一點(diǎn)問題,發(fā)現(xiàn)之前對ORDER BY理解是錯(cuò)誤的
    2012-07-07
  • MySQL默認(rèn)值(DEFAULT)的使用

    MySQL默認(rèn)值(DEFAULT)的使用

    本文介紹了MySQL中默認(rèn)值(Default)的使用方法,包括創(chuàng)建表時(shí)設(shè)置默認(rèn)值約束、修改表時(shí)添加和刪除默認(rèn)值約束等,具有一定的參考價(jià)值,感興趣的可以了解一下
    2025-01-01
  • 新裝MySql后登錄出現(xiàn)root帳號提示mysql ERROR 1045 (28000): Access denied for use的解決辦法

    新裝MySql后登錄出現(xiàn)root帳號提示mysql ERROR 1045 (28000): Access denied

    這篇文章主要介紹了新裝MySql后登錄出現(xiàn)root帳號提示mysql ERROR 1045 (28000): Access denied for use的解決辦法,需要的朋友可以參考下
    2017-01-01
  • Linux環(huán)境下mysql5.7.13安裝教程

    Linux環(huán)境下mysql5.7.13安裝教程

    這篇文章主要為大家詳細(xì)介紹了Linux環(huán)境下mysql5.7.13安裝教程,感興趣的小伙伴們可以參考一下
    2016-07-07
  • MySQL與PHP的基礎(chǔ)與應(yīng)用專題之?dāng)?shù)據(jù)完整性

    MySQL與PHP的基礎(chǔ)與應(yīng)用專題之?dāng)?shù)據(jù)完整性

    MySQL是一個(gè)關(guān)系型數(shù)據(jù)庫管理系統(tǒng),由瑞典MySQL?AB?公司開發(fā),屬于?Oracle?旗下產(chǎn)品。MySQL?是最流行的關(guān)系型數(shù)據(jù)庫管理系統(tǒng)之一,本系列將帶你掌握php與mysql的基礎(chǔ)應(yīng)用,本篇從數(shù)據(jù)完整性開始
    2022-02-02
  • MySQL存儲(chǔ)結(jié)構(gòu)用法案例分析

    MySQL存儲(chǔ)結(jié)構(gòu)用法案例分析

    這篇文章主要介紹了MySQL存儲(chǔ)結(jié)構(gòu)用法,結(jié)合具體案例形式分析了mysql存儲(chǔ)結(jié)構(gòu)相關(guān)使用方法與操作注意事項(xiàng),需要的朋友可以參考下
    2018-07-07
  • mysql的查詢緩存說明

    mysql的查詢緩存說明

    mysql的Query Cache有其特殊的業(yè)務(wù)場景,也不像其他數(shù)據(jù)庫產(chǎn)品,緩存查詢語句的執(zhí)行計(jì)劃等信息,而是直接緩存查詢語句的記錄集和對應(yīng)的SQL語句
    2013-02-02

最新評論

嘉兴市| 鄱阳县| 连平县| 平原县| 华亭县| 澄城县| 吴江市| 峨边| 葵青区| 德保县| 富阳市| 德保县| 富锦市| 岱山县| 岳阳县| 喀喇| 宁阳县| 湘乡市| 乐山市| 当雄县| 西昌市| 沾益县| 普安县| 桃园市| 天气| 晋中市| 策勒县| 溧水县| 娱乐| 楚雄市| 荣昌县| 沂南县| 和硕县| 广南县| 六枝特区| 中宁县| 桐柏县| 墨江| 罗平县| 维西| 繁昌县|