linux7yum安装mysql,CentOS7 使用yum安装mysql

1、安装libaio,

yum install libaio

2、卸载mariadb

yum  remove  mariadb-libs-5.5.41-2.el7_0.x86_64

3、下载mysql yumrepository

wget  http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

4、添加Mysql yumrepository到系统列表的中,执行

yum localinstall  mysql-community-release-el7-5.noarch.rpm

5、查看yum源中的版本

yum repolist all | grep mysql

mysql-connectors-community/x86_64 MySQLConnectors Community启用:    24

mysql-connectors-community-source MySQLConnectors Community - Sourc禁用

mysql-tools-community/x86_64      MySQL Tools Community启用:    38

mysql-tools-community-source      MySQL Tools Community - Source禁用

mysql55-community/x86_64          MySQL 5.5 Community Server禁用

mysql55-community-source          MySQL 5.5 Community Server - Sourc禁用

mysql56-community/x86_64          MySQL 5.6 Community Server启用:   289

mysql56-community-source          MySQL 5.6 Community Server - Sourc禁用

mysql57-community-dmr/x86_64      MySQL 5.7 Community Server Develop禁用

mysql57-community-dmr-source      MySQL 5.7 Community Server Develop禁用

6、可以通过修改/etc/yum.repos.d/mysql-community.repo文件来决定启用哪个版本,例如启用下面的版本

# 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/7/$basearch/

enabled=1

gpgcheck=1

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

7、查看启用的哪个版本

yum repolist enabled | grep mysql

mysql-connectors-community/x86_64        MySQL Connectors Community           24

mysql-tools-community/x86_64             MySQL Tools Community                38

mysql56-community/x86_64                 MySQL 5.6 CommunityServer          289

8、安装mysql,执行下面的命令

yum install mysql-community-server

需要安装下图所示的包

依赖关系解决

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

Package架构版本源大小

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

正在安装:

mysql-community-server                    x86_64                   5.6.34-2.el7                       mysql56-community                    59 M

为依赖而安装:

mysql-community-client                    x86_64                   5.6.34-2.el7                       mysql56-community                    19 M

mysql-community-common                    x86_64                   5.6.34-2.el7                       mysql56-community                   257 k

mysql-community-libs                      x86_64                   5.6.34-2.el7                       mysql56-community                   2.0 M

perl-Compress-Raw-Bzip2                   x86_64                   2.061-3.el7                        base                                 32 k

perl-Compress-Raw-Zlib                    x86_64                   1:2.061-4.el7                      base                                 57 k

perl-DBI                                  x86_64                   1.627-4.el7                        base                                802 k

perl-IO-Compress                          noarch                   2.061-2.el7                        base                                260 k

perl-Net-Daemon                           noarch                   0.48-5.el7                         base                                 51 k

perl-PlRPC                                noarch                   0.2020-14.el7                      base                                 36 k

9、启动mysql

systemctl start mysqld

10、查看mysql状态

systemctl status mysqld

mysqld.service - MySQL Community Server

Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)

Active: active (running) since六2016-10-29 03:57:59CST; 56s ago

Process: 4549 ExecStartPost=/usr/bin/mysql-systemd-start post(code=exited, status=0/SUCCESS)

Process: 4489 ExecStartPre=/usr/bin/mysql-systemd-start pre(code=exited, status=0/SUCCESS)

MainPID: 4548 (mysqld_safe)

CGroup: /system.slice/mysqld.service

├─4548 /bin/sh /usr/bin/mysqld_safe

└─4701 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql--plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mys...

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: Support MySQL by buyingsupport/licenses at http://shop.mysql.com

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: Note: new default config filenot created.

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: Please make sure your configfile is current

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: WARNING: Default config file/etc/my.cnf exists on the system

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: This file will be read bydefault by the MySQL server

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: If you do not want to usethis, either remove it, or use the

10月29 03:57:57localhost.localdomain mysql-systemd-start[4489]: --defaults-file argument tomysqld_safe when starting the server

10月29 03:57:57localhost.localdomain mysqld_safe[4548]: 161029 03:57:57 mysqld_safe Logging to'/var/log/mysqld.log'.

10月29 03:57:58 localhost.localdomainmysqld_safe[4548]: 161029 03:57:58 mysqld_safe Starting mysqld daemon withdatabases from /...mysql

10月29 03:57:59localhost.localdomain systemd[1]: Started MySQL Community Server.

Hint: Some lines were ellipsized, use -l toshow in full.

11、测试安装是否成功

mysql可以正常的登入

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

Your MySQL connection id is 2

Server version: 5.6.34 MySQL CommunityServer (GPL)

Copyright (c) 2000, 2016, Oracle and/or itsaffiliates. All rights reserved.

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

mysql>

12、关闭firewall,禁止firewall开机启动

systemctl stop firewalld.service

systemctl disable firewalld.service

13、安装iptables防火墙,并启用iptables

yum install iptables-services

service iptables start

14、mysql 安全设置

执行mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FORALL MySQL

SERVERS INPRODUCTION USE!  PLEASE READ EACH STEPCAREFULLY!

In order to log into MySQL to secure it, we'll need thecurrent

password for the root user. If you've just installed MySQL, and

you haven't set the root password yet, the password will beblank,

so you should just press enter here.

Enter current password for root (enter for none):

ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: YES)

Enter current password for root (enter for none):

ERROR 1045 (28000): Access denied for user'root'@'localhost' (using password: YES)

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log intothe MySQL

root user without the proper authorisation.

Set root password? [Y/n] Y

New password:

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MySQL installation has an anonymous user,allowing anyone

to log into MySQL without having to have a user accountcreated for

them.  This isintended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connect from'localhost'.  This

ensures that someone cannot guess at the root password fromthe network.

Disallow root login remotely? [Y/n] n

... skipping.

By default, MySQL comes with a database named 'test' thatanyone can

access.  This is alsointended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y

- Dropping testdatabase...

ERROR 1008 (HY000) at line 1: Can't drop database 'test';database doesn't exist

... Failed!  Not critical, keep moving...

- Removingprivileges on test database...

... Success!

Reloading the privilege tables will ensure that all changesmade so far

will take effect immediately.

Reload privilege tables now? [Y/n] y

... Success!

All done!  If you'vecompleted all of the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

Cleaning up...

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/505526.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux读整个文件内容,Linux查看整个文件

Linux查看整个文件使用cat命令显示文本文件的内容使用cat命令可以显示文本文件的内容。cat后面可以不加任何选项,直接跟文件名功能说明:查看某个文件的内容###cat命令语法cat [参数] [文件]选项与参数:-A:显示所有的内容&#xff…

linux终端怎么设置monaco,Monaco Editor 使用指南

为什么要写这篇文章?最近开发了一个简单的在线代码编辑器,基于 Monaco Editor 实现,没有了解过 Monaco 的人可能不知道,我们常用的 VS Code 也是基于它实现的~回到正题,Monaco Editor 有一份完整的官方文档&#xff0c…

linux c实现线程超时退出,c – 如何在另一个线程的超时内唤醒select()

根据“男人选择”信息:"On success, select() and pselect() return the number of file descrip‐tors contained in the three returned descriptor sets which may be zeroif the timeout expires before anything interesting happens. On error,-1 is ret…

linux中var的作用,linux中var是什么意思

在搭建Kubernetes集群过程中,安装了kube-dns插件后,运行一个ubuntu容器,发现容器内无法解析集群外域名,一开始可以解析集群内域名,一段时间后也无法解析集群内域名。$ nslookup kubernetes.default Server: 10.99.0.2 …

linux redis 主从配置,redis集群(主从配置)

redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、 list(链表)、set(集合)和zset(有序集合)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操 作,而且这些操作都是…

telnet入侵linux,教你入侵RedHatLinux

此文的目的不在于教人入侵,而是为了提高自身的技术和加强网络管理员的安全防范意识。仅此而已!粗心大意的网络管理员应该明白:由于你们一个小小的操作失误可能会导致整个网络全面沦陷!本文主要是围绕LPD:网络打印服务的攻击而进行的。首先确定目标&#…

linux telnet.class,Linux telnet简单实用方法

语法telnet [-a][-e escape char][-f log file][-l user][-t term][host [port]]参数-a 企图自动登录。除了用当前已登陆的用户名以外,与 -l 选项相同。-e 跳过字符来进入 telnet 客户提示。-f 客户端登录的文件名-l 指定远程系统上登录用的用户名称。要求远程系统支…

linux查找文件名赋值给变量,Linux平台从文件中查找字符赋值于变量

以telnet方式登录Linux主机,在默认目录下用命令创建一个包含DUT wanIP的文本文件。[root] echo wanIP88.0.100.253 > ./wanIP.txt在默认目录下创建包含以下内容的shell脚本。在实际操作中,可能需要利用命令执行多条相同的命令。在命令后面加上"&…

linux两个数字正则,正则表达式-Linux readelf显示具有不同数字系...

我正在研究ELF文件中的一些对象,并为此目的使用了readelf.这个readelf样本显示了第3列上对象的大小(字节),在大型物体上,readelf以十六进制而不是dec打印,这打断了我的尺寸排序尝试. (排序忽略十六进制值)Num: Value Size Type Bind Vis Ndx Name1369: 808ec6e8 2048 OBJECT LO…

c++语言成绩统计系统数组,急求!!!关于学生成绩管理系统的C++ 结构体数组...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼scanf("%d",&p->data.cgrade);getchar();printf("请你输入数学成绩:");scanf("%d",&p->data.mgrade);getchar();printf("请你输入英语成绩:");scanf("%d",&p…

c语言中实现自动平移,c语言实现图像的旋转与平移

yyy(4) ty≥height,图象完全移出了屏幕,不用做任何处理。这种做法利用了位图存储的连续性,即同一行的象素在内存中是相邻的。利用 memcpy函数, 从(x ,y )-x )处,拷 0 0 点开始,一次可以拷贝一整…

c语言编写电子秒表程序,电子秒表C程序.doc

电子秒表C程序电子秒表程序#include#include#define uchar unsigned char#define uint unsigned intuchar code segtab[]{0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x89,0x8c,0xff};uchar dbuf[3]{0,0,0};uint count;uchar sec;uchar…

c语言星空程序,C语言实现动态星空

1、/ 编译环境:Visual C 6.0,EasyX 2014冬至版/ e a s y x . c n/#include #include #include #define MAXSTAR 200/ 星星总数struct STARdoublex;inty;doublestep;intcolor;STAR starMAXSTAR;/ 初始化星星void InitStar(int i)stari.x 0;stari.y rand…

c语言stanf,stanf

1、很多问题的答案只能是“是”或“否”,但很多人总是通过说“我不告诉你”或者“我不知道”来逃避。2、假的事情总是显得过于巧合,过于圆满,以至于最后被揭穿。生活中的事情要都那么完美就不会有那么多人不快乐了。3、“肯定”表示有90&…

c语言循环数组赋值,for循环里边给数组赋值的难题

[Quote]/* E5.4 */#include int main(void){double data[12][5];int i0; //总共有多少个数字double row2.0; //初始数字for(i0;i<11;i){data[i][0]row;printf(“\n%d\t%.2f”,i,data[i][0]);rowrow0.1;}return 0;}[/QUOTE]我是C的初学者&#xff0c;这个程序本身没有问题&…

用c语言 c 做8位数奇校验,计算机硬件技术基础网上作业及答案

第一章概述1&#xff0e;下列叙述错误的是()A&#xff0e;目前大多数计算机结构仍属冯诺依曼结构B&#xff0e;计算机的工作原理基于“程序存储和控制”C&#xff0e;计算机的速度取决于CPU的主频&#xff0c;主频高的CPU速度快D&#xff0e;计算机系统包括硬件、软件两部分2&a…

c语言元素插入数组并排序,一数组按顺序序存放,插入一个数,按原来排序规律放在相应位置...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼前面已经有一道类似的题目为这道题做铺垫&#xff0c;我已经做出来啦。前面的题目是这样的&#xff1a;用选择法对10个数进行排序。我的做法&#xff0c;就是一个个对比扫描&#xff0c;从左到右递增。代码如下&#xff1a;#includ…

linux mpeg-4,嵌入式MPEG-4解码系统的设计与实现,嵌入式MPEG-4解码系统,嵌入式Linux,视频码流,P...

介绍了一种嵌入式高图像质量的MPEC-4视频流解码系统。该系统以嵌入式Linux作为操作系统&#xff0c;采用硬解码方式&#xff0c;把IDE接口设备或网络端口输入的MPEC-4视频码流(ES、PS和TS)转换成PAL&#xff0f;NTSC制式的电视信号输出。重点讨论了系统控制和MPEG-4解码部分的设…

android 手机壁纸源码,Android工程实现换壁纸功能【附源码】

最近工作要实现换壁纸小功能,将代码做成demo发出来没有采用zip格式换肤,因为只是更换一张图片背景1.将三张图放入drawable-hdpi,我放的是480*800的2.用sharedPreference存取皮肤的id,以便于下次启动的时候根据id来选择用哪个皮肤,在onresume()里刷新皮肤3.存到sharedPreference…

android webview 加载本地,webview加载本地资源的各种尝试

1.webview 打开sd卡上的静态html文件 &#xff0c;js文件既然放在assets文件夹下能找到&#xff0c;那能通过放在sd卡&#xff0c;能加载吗&#xff1f;答&#xff1a;事实证明&#xff0c;是没有用的。2.既然能拿到html的数据&#xff0c;那我们是不是重写html的script的tag的…