您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)CentOS 6.7下yum方式怎么安裝MySQL 5.6,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
1、下載yum源
我的測試環(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、開始現(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
解決依賴關(guān)系
--> 執(zhí)行事務(wù)檢查
---> Package mysql-community-server.x86_64 0:5.6.47-2.el6 will be 安裝
--> 處理依賴關(guān)系 mysql-community-common(x86-64) = 5.6.47-2.el6,它被軟件包 mysql-community-server-5.6.47-2.el6.x86_64 需要
--> 處理依賴關(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 安裝
--> 處理依賴關(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 安裝
--> 完成依賴關(guān)系計(jì)算
依賴關(guān)系解決
================================================================================================================================================================
軟件包 架構(gòu) 版本 倉庫 大小
================================================================================================================================================================
正在安裝:
mysql-community-server x86_64 5.6.47-2.el6 mysql56-community 77 M
為依賴而安裝:
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)
總文件大?。?14 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ù)測試
事務(wù)測試成功
執(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
作為依賴被安裝:
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、啟動mysql服務(wù)
[root@test ~]# service mysqld start
初始化 MySQL 數(shù)據(jù)庫: 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
[確定]
正在啟動 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用戶密碼
[root@test ~]# mysqladmin -u root password "mysql123"
Warning: Using a password on the command line interface can be insecure.
8、查看數(shù)據(jù)庫和創(chuàng)建數(shù)據(jù)庫
[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ù)庫目錄
[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,小編相信有部分知識點(diǎn)可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。