CentOS6.7下yum方式怎么安裝MySQL5.6

本篇文章給大家分享的是有關(guān)CentOS 6.7下yum方式怎么安裝MySQL 5.6,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話(huà)不多說(shuō),跟著小編一起來(lái)看看吧。

創(chuàng)新互聯(lián)建站專(zhuān)注于網(wǎng)站建設(shè)、成都做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站制作、網(wǎng)站開(kāi)發(fā)。公司秉持“客戶(hù)至上,用心服務(wù)”的宗旨,從客戶(hù)的利益和觀點(diǎn)出發(fā),讓客戶(hù)在網(wǎng)絡(luò)營(yíng)銷(xiāo)中找到自己的駐足之地。尊重和關(guān)懷每一位客戶(hù),用嚴(yán)謹(jǐn)?shù)膽B(tài)度對(duì)待客戶(hù),用專(zhuān)業(yè)的服務(wù)創(chuàng)造價(jià)值,成為客戶(hù)值得信賴(lài)的朋友,為客戶(hù)解除后顧之憂(yōu)。

1、下載yum源

 我的測(cè)試環(huán)境如下:

[root@test ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)

所以下載了centos6系統(tǒng)yum源:

wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm

3、修改yum源配置

 vim /etc/yum.repos.d/mysql-community.repo

安裝mysql5.6操作

1)、將其他版本enabled=1更改為enabled=0

2)、將5.6版本enabled=0更改為enabled=1

# Enable to use MySQL 5.6

[mysql56-community]

name=MySQL 5.6 Community Server

baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

4、開(kāi)始現(xiàn)在安裝包并安裝

[root@test ~]# yum install mysql-community-server

已加載插件:fastestmirror, security

設(shè)置安裝進(jìn)程

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * epel: mirrors.yun-idc.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

解決依賴(lài)關(guān)系

--> 執(zhí)行事務(wù)檢查

---> Package mysql-community-server.x86_64 0:5.6.47-2.el6 will be 安裝

--> 處理依賴(lài)關(guān)系 mysql-community-common(x86-64) = 5.6.47-2.el6,它被軟件包 mysql-community-server-5.6.47-2.el6.x86_64 需要

--> 處理依賴(lài)關(guān)系 mysql-community-client(x86-64) >= 5.6.10,它被軟件包 mysql-community-server-5.6.47-2.el6.x86_64 需要

--> 執(zhí)行事務(wù)檢查

---> Package mysql-community-client.x86_64 0:5.6.47-2.el6 will be 安裝

--> 處理依賴(lài)關(guān)系 mysql-community-libs(x86-64) >= 5.6.10,它被軟件包 mysql-community-client-5.6.47-2.el6.x86_64 需要

---> Package mysql-community-common.x86_64 0:5.6.47-2.el6 will be 安裝

--> 執(zhí)行事務(wù)檢查

---> Package mysql-community-libs.x86_64 0:5.6.47-2.el6 will be 安裝

--> 完成依賴(lài)關(guān)系計(jì)算

依賴(lài)關(guān)系解決

================================================================================================================================================================

 軟件包                                        架構(gòu)                          版本                                倉(cāng)庫(kù)                                      大小

================================================================================================================================================================

正在安裝:

 mysql-community-server                        x86_64                        5.6.47-2.el6                        mysql56-community                         77 M

為依賴(lài)而安裝:

 mysql-community-client                        x86_64                        5.6.47-2.el6                        mysql56-community                         34 M

 mysql-community-common                        x86_64                        5.6.47-2.el6                        mysql56-community                        341 k

 mysql-community-libs                          x86_64                        5.6.47-2.el6                        mysql56-community                        3.6 M

事務(wù)概要

================================================================================================================================================================

Install       4 Package(s)

總文件大小:114 M

總下載量:77 M

Installed size: 478 M

確定嗎?[y/N]:y

下載軟件包:

mysql-community-server-5.6.47-2.el6.x86_64.rpm                                                                                           |  77 MB     43:30    

warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Importing GPG key 0x5072E1F5:

 Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>

 Package: mysql57-community-release-el6-7.noarch (installed)

 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

確定嗎?[y/N]:y

運(yùn)行 rpm_check_debug

執(zhí)行事務(wù)測(cè)試

事務(wù)測(cè)試成功

執(zhí)行事務(wù)

Warning: RPMDB altered outside of yum.

  正在安裝   : mysql-community-common-5.6.47-2.el6.x86_64                                                                                                   1/4

  正在安裝   : mysql-community-libs-5.6.47-2.el6.x86_64                                                                                                     2/4

  正在安裝   : mysql-community-client-5.6.47-2.el6.x86_64                                                                                                   3/4

  正在安裝   : mysql-community-server-5.6.47-2.el6.x86_64                                                                                                   4/4

  Verifying  : mysql-community-libs-5.6.47-2.el6.x86_64                                                                                                     1/4

  Verifying  : mysql-community-common-5.6.47-2.el6.x86_64                                                                                                   2/4

  Verifying  : mysql-community-client-5.6.47-2.el6.x86_64                                                                                                   3/4

  Verifying  : mysql-community-server-5.6.47-2.el6.x86_64                                                                                                   4/4

已安裝:

  mysql-community-server.x86_64 0:5.6.47-2.el6                                                                                                                 

作為依賴(lài)被安裝:

  mysql-community-client.x86_64 0:5.6.47-2.el6         mysql-community-common.x86_64 0:5.6.47-2.el6         mysql-community-libs.x86_64 0:5.6.47-2.el6       

完畢!

5、啟動(dòng)mysql服務(wù)

[root@test ~]# service mysqld start

初始化 MySQL 數(shù)據(jù)庫(kù): 2020-03-30 23:47:20 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2020-03-30 23:47:20 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

  /usr/bin/mysqladmin -u root password 'new-password'

  /usr/bin/mysqladmin -u root -h test password 'new-password'

Alternatively you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test

Note: new default config file not created.

Please make sure your config file is current

WARNING: Default config file /etc/my.cnf exists on the system

This file will be read by default by the MySQL server

If you do not want to use this, either remove it, or use the

--defaults-file argument to mysqld_safe when starting the server

                                                           [確定]

正在啟動(dòng) mysqld:                                          [確定]

6、查看狀態(tài)和版本

[root@test ~]#  chkconfig --list | grep mysqld

mysqld          0:關(guān)閉  1:關(guān)閉  2:關(guān)閉  3:啟用  4:啟用  5:啟用  6:關(guān)閉

[root@test ~]# mysqladmin --version

mysqladmin  Ver 8.42 Distrib 5.6.47, for Linux on x86_64

[root@test ~]#  mysqladmin -u root password "mysql123"

Warning: Using a password on the command line interface can be insecure.

[root@test ~]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.6.47 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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.

7、設(shè)置root用戶(hù)密碼

[root@test ~]#  mysqladmin -u root password "mysql123"

Warning: Using a password on the command line interface can be insecure.

8、查看數(shù)據(jù)庫(kù)和創(chuàng)建數(shù)據(jù)庫(kù)

[root@test mysql]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.6.47 MySQL Community Server (GPL)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

+--------------------+

3 rows in set (0.00 sec)

mysql> CREATE DATABASE testtb DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

Query OK, 1 row affected (0.00 sec)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| testtb             |

+--------------------+

4 rows in set (0.00 sec)

9、查看數(shù)據(jù)庫(kù)目錄

[root@test ~]# ls /var/lib/mysql -al

總用量 110616

drwxr-xr-x   5 mysql mysql     4096 3月  31 00:19 .

drwxr-xr-x. 30 root  root      4096 3月  30 20:57 ..

-rw-rw----   1 mysql mysql       56 3月  30 23:47 auto.cnf

-rw-rw----   1 mysql mysql 12582912 3月  30 23:47 ibdata1

-rw-rw----   1 mysql mysql 50331648 3月  30 23:47 ib_logfile0

-rw-rw----   1 mysql mysql 50331648 3月  30 23:47 ib_logfile1

drwx------   2 mysql mysql     4096 3月  30 23:47 mysql

srwxrwxrwx   1 mysql mysql        0 3月  30 23:47 mysql.sock

drwx------   2 mysql mysql     4096 3月  30 23:47 performance_schema

drwx------   2 mysql mysql     4096 3月  31 00:19 testtb

以上就是CentOS 6.7下yum方式怎么安裝MySQL 5.6,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

名稱(chēng)欄目:CentOS6.7下yum方式怎么安裝MySQL5.6
本文URL:http://bm7419.com/article44/jcidhe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、手機(jī)網(wǎng)站建設(shè)、外貿(mào)建站、網(wǎng)站設(shè)計(jì)公司網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)