CentOS 6.7下yum方式安裝MySQL 5.6
1、下載yum源
我的測試環境如下:
[root@test ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
所以下載了centos6系統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=
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
4 、開始現在安裝包並安裝
[root@test ~]# yum install mysql-community-server
已載入外掛: fastestmirror, security
設定安裝程式
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.yun-idc.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
解決依賴關係
--> 執行事務檢查
---> Package mysql-community-server.x86_64 0:5.6.47-2.el6 will be 安裝
--> 處理依賴關係 mysql-community-common(x86-64) = 5.6.47-2.el6 ,它被軟體包 mysql-community-server-5.6.47-2.el6.x86_64 需要
--> 處理依賴關係 mysql-community-client(x86-64) >= 5.6.10 ,它被軟體包 mysql-community-server-5.6.47-2.el6.x86_64 需要
--> 執行事務檢查
---> Package mysql-community-client.x86_64 0:5.6.47-2.el6 will be 安裝
--> 處理依賴關係 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 安裝
--> 執行事務檢查
---> Package mysql-community-libs.x86_64 0:5.6.47-2.el6 will be 安裝
--> 完成依賴關係計算
依賴關係解決
================================================================================================================================================================
軟體包 架構 版本 倉庫 大小
================================================================================================================================================================
正在安裝 :
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
事務概要
================================================================================================================================================================
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
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
執行 rpm_check_debug
執行事務測試
事務測試成功
執行事務
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 服務
[root@test ~]# service mysqld start
初始化 MySQL 資料庫: 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 、檢視狀態和版本
[root@test ~]# chkconfig --list | grep mysqld
mysqld 0: 關閉 1: 關閉 2: 關閉 3: 啟用 4: 啟用 5: 啟用 6: 關閉
[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 、設定 root 使用者密碼
[root@test ~]# mysqladmin -u root password "mysql123"
Warning: Using a password on the command line interface can be insecure.
8 、檢視資料庫和建立資料庫
[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 、檢視資料庫目錄
[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
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-2683374/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 安裝 mysql 5.6CentOSMySql
- Linux上yum安裝mysql5.6LinuxMySql
- CentOS7 安裝 Mysql 8:0 的yum安裝方式CentOSMySql
- CentOS安裝MySQL的兩種方式——RPM和YUMCentOSMySql
- CentOS 7 yum 安裝 MySQLCentOSMySql
- CentOS 7 用yum安裝 MySQLCentOSMySql
- 在Linux(Redhat/CentOS)下安裝MySQL之yum(rpm)線上安裝方式LinuxRedhatCentOSMySql
- 在Linux(Redhat/CentOS)下安裝MySQL之yum(rpm)離線安裝方式LinuxRedhatCentOSMySql
- centOS 7 離線安裝 MySQL 5.6 完美安裝CentOSMySql
- 在CentOS7上安裝MySQL5.7-YUM源方式CentOSMySql
- CentOS 7.0下使用yum安裝MySQLCentOSMySql
- Linux – CentOS 7 yum方式快速安裝MongoDBLinuxCentOSMongoDB
- centos7 yum安裝php5.6以及擴充套件CentOSPHP套件
- CentOS7下yum安裝MySQL 5.7CentOSMySql
- CentOS7 yum安裝MySQL5.7CentOSMySql
- CentOS8 安裝 MySQL8.0(yum)CentOSMySql
- centos7安裝mysql5.7 使用yumCentOSMySql
- CentOS下使用yum方式安裝percona xtrabackup步驟CentOS
- CentOS安裝配置yumCentOS
- mysql yum 安裝MySql
- Windows 安裝 MySQL 5.6WindowsMySql
- CentOS7 透過YUM安裝MySQL5.7CentOSMySql
- Mysql5.6 for Centos6.5原始碼編譯安裝MySqlCentOS原始碼編譯
- Centos 7 yum 安裝nginxCentOSNginx
- CentOS 7 yum 安裝 NGINXCentOSNginx
- yum方式安裝及配置最新的mysql5.7MySql
- CentOS7下MySQL5.7安裝與配置(YUM)CentOSMySql
- CentOS 7.0下使用yum安裝mysql的方法詳解CentOSMySql
- CentOS 下 MySQL 5.6 基於 RPM 的下載、安裝、配置CentOSMySql
- 在VMware已安裝的CentOS7.9上編譯安裝mysql5.6CentOS編譯MySql
- Linux安裝Mysql5.6LinuxMySql
- centos 7中 yum安裝jdkCentOSJDK
- CentOs6.8 yum安裝GitLabCentOSGitlab
- Centos 7 升級通過 yum 安裝的 MySQL 5.7 到 MySQL 8.0CentOSMySql
- 在linux(Centos 7以上版本親測)上安裝mysql5.6LinuxCentOSMySql
- CentOS 7 下使用yum安裝MySQL5.7方法CentOSMySql
- 安裝最新版MySQL(yum安裝)MySql
- Windows 安裝並配置 MySQL 5.6WindowsMySql