CentOS6.7下yum方式怎么安装MySQL5.6-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

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

本篇文章给大家分享的是有关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=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、开始现在安装包并安装

[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 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Importing GPG key 0x5072E1F5:

 Userid : MySQL Release Engineering

 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

以上就是CentOS 6.7下yum方式怎么安装MySQL 5.6,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


本文名称:CentOS6.7下yum方式怎么安装MySQL5.6
网址分享:http://kswsj.cn/article/jcidhe.html

其他资讯