search
HomeDatabaseMysql Tutorial腾讯云CentOS7.0使用yum安装mysql_MySQL

背景:

今天才申请了腾讯云+校园计划的1元服务器,(http://www.qcloud.com/event/qcloudSchool)安装了Centos7.0,在安装mysql的时候,使用yum list | grep mysql 来查找yum源中是否有mysql,结果如下:

<code class="hljs avrasm">[root@VM_47_56_centos ~]# yum list | grep mysql
akonadi-mysql.x86_64                    1.9.2-4.el7                    base     
apr-util-mysql.x86_64                   1.5.2-6.el7                    base       
mysql-proxy.x86_64                      0.8.5-2.el7                    epel     
mysql-proxy-devel.x86_64                0.8.5-2.el7                    epel     
mysql-router.x86_64                     2.0.2-1.el7                    mysql-tools-community
mysql-router-debuginfo.x86_64           2.0.2-1.el7                    mysql-tools-community
mysql-utilities.noarch                  1.5.6-1.el7                    mysql-tools-community
mysql-utilities-extra.noarch            1.5.6-1.el7                    mysql-tools
mysqlreport.noarch                      3.5-11.el7                     epel     
mysqltuner.noarch                       1.2.0-7.el7                    epel     
省略部分内容。。。。
[root@VM_47_56_centos ~]# </code>

总之是看不到mysql-server的影子,(PS:据说Centos7.0的源中暂时还没有mysql,但是相同版本的Centos在阿里云是可以直接使用yum install mysql-server 来直接安装mysql的)

于是找了一些mysql的安装源,安装过程如下:

安装过程:

为了解决这个问题,我们要先下载mysql的repo源。

1、下载mysql的repo源
<code class="hljs avrasm"><code class="hljs avrasm">$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm</code></code>
<code class="hljs avrasm">2、安装mysql-community-release-el7-5.noarch.rpm包
<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso">$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm</code></code></code>

<code class="hljs avrasm"><code class="hljs lasso">安装这个包后,会获得两个mysql的yum repo源:<br> /etc/yum.repos.d/mysql-community.repo和<br> /etc/yum.repos.d/mysql-community-source.repo。

<code class="hljs avrasm"><code class="hljs lasso">3、安装mysql
<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash">$ sudo yum install mysql-server</code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash">这个过程中就会看到有mysql的软件包存在:

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc">[root@VM_47_56_centos ~]# sudo yum install mysql-server
已加载插件:fastestmirror, langpacks                   
| 2.5 kB  00:00:00     
mysql-tools-community                                                                  | 2.5 kB  00:00:00     
mysql56-community                                                                         | 2.5 kB  00:00:00     
(1/3): mysql-connectors-community/x86_64/primary_db                                       | 8.6 kB  00:00:00     
(2/3): mysql-tools-community/x86_64/primary_db                                            |  22 kB  00:00:00     
(3/3): mysql56-community/x86_64/primary_db                                                | 109 kB  00:00:01     
Loading mirror speeds from cached hostfile
 * base: mirrors.sina.cn
 * extras: mirrors.sina.cn
 * updates: mirrors.sina.cn
正在解决依赖关系
--> 正在检查事务

省略内容。。。

依赖关系解决
=================================================================================================================
 Package                           架构             版本                       源                           大小
=================================================================================================================
正在安装:
 mysql-community-libs              x86_64           5.6.27-2.el7               mysql56-community           2.0 M
      替换  mariadb-libs.x86_64 1:5.5.44-1.el7_1
 mysql-community-server            x86_64           5.6.27-2.el7               mysql56-community            58 M
为依赖而安装:
 mysql-community-client            x86_64           5.6.27-2.el7               mysql56-community            19 M
 mysql-community-common            x86_64           5.6.27-2.el7               mysql56-community           256 k
 numactl-libs                      x86_64           2.0.9-5.el7_1              

事务概要
=================================================================================================================
安装  2 软件包 (+9 依赖软件包)

总下载量:80 M
Is this ok [y/d/N]: y</code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc">下边的安装和其他安装一样,

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc">根据步骤安装就可以了,不过安装完成后,没有密码,需要重置密码。

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc">4、重置密码

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc">重置密码前,首先要登录

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby">$ mysql -u root</code></code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby">登录时有可能报这样的错:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2),原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户:

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash">$ sudo chown -R mysql:mysql /var/lib/mysql #这里的mysql是用户名(需要设置用户组合用户)</code></code></code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash">然后,重启服务:

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby">$ service mysqld restart</code></code></code></code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby">接下来登录重置密码:

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php">$ mysql -u root
mysql > use mysql;
mysql > update user set password=password(&#39;xu827928&#39;) where user=&#39;root&#39;;
mysql > exit;</code></code></code></code></code></code></code></code></code>
<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php">5、开放3306端口(可以不用设置)
<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash">$ sudo vim /etc/sysconfig/iptables</code></code></code></code></code></code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash">添加以下内容:

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash"><code class="hljs lasso">-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT</code></code></code></code></code></code></code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash"><code class="hljs lasso">保存后重启防火墙:

<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash"><code class="hljs lasso"><code class="hljs bash">$ sudo service iptables restart</code></code></code></code></code></code></code></code></code></code></code></code>

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash"><code class="hljs lasso"><code class="hljs bash">这样从其它客户机也可以连接上mysql服务了。

<code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash"><code class="hljs lasso"><code class="hljs bash">6、修改权限可以使其他机器登录:
<code class="hljs avrasm"><code class="hljs avrasm"><code class="hljs lasso"><code class="hljs bash"><code class="hljs asciidoc"><code class="hljs ruby"><code class="hljs bash"><code class="hljs ruby"><code class="hljs php"><code class="hljs bash"><code class="hljs lasso"><code class="hljs bash"><code class="hljs lasso">?mysql>mysql -h localhost -u root  //这样应该可以进入MySQL服务器 
mysql>GRANT ALL PRIVILEGES ON *.* TO &#39;root&#39;@&#39;%&#39; WITH GRANT OPTION  //赋予任何主机访问数据的权限 
mysql>FLUSH PRIVILEGES //修改生效 
mysql>EXIT //退出MySQL服务器</code></code></code></code></code></code></code></code></code></code></code></code></code>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
腾讯dns地址是多少腾讯dns地址是多少Feb 22, 2023 am 10:43 AM

腾讯dns地址是“119.29.29.29”;类似于其他公共DNS,如Google的“8.8.8.8”和114dns的“114.114.114.114”,可以为全网用户提供域名的公共递归解析服务。

qq是腾讯的吗qq是腾讯的吗Oct 09, 2022 am 11:34 AM

qq是腾讯的。QQ是1999年2月由腾讯公司推出的一款基于互联网的即时通信网络工具,其标志是一只戴着红色围巾的小企鹅;QQ支持在线聊天、视频通话、点对点断点续传文件、共享文件、网络硬盘、自定义面板、QQ邮箱等多种功能,并可与多种通讯终端相连。

腾讯宣布调整微信支付和视频号组织架构,加大对“直播带货”的投资腾讯宣布调整微信支付和视频号组织架构,加大对“直播带货”的投资Jan 12, 2024 pm 04:30 PM

根据科创板日报的报道,微信视频号正在加大对直播带货的资源投入,为此已经对微信支付和视频号两个团队的组织架构进行了调整据知情人士透露,腾讯的目的是为了实现微信支付和视频号的互通,希望两个团队能够合作共同努力。据称,这次调整计划于今年双11之前后开始,旨在将更多资源投入到“直播带货”领域根据本站查询结果显示,腾讯是一家著名的互联网公司,自成立以来已经多次进行组织架构调整,目前包括六大事业群和S线企业发展事业群(CDG)云与智慧产业事业群(CSIG)互动娱乐事业群(IEG)平台与内容事业群(PCG)技

提升用户体验:腾讯QQ NT桌面版内存优化再升级提升用户体验:腾讯QQ NT桌面版内存优化再升级Aug 11, 2023 pm 04:57 PM

腾讯QQ桌面客户端近期进行了一系列重大改革,针对用户反馈的高内存占用、超大安装包和启动缓慢等问题,QQ技术团队在内存方面进行了专项优化,取得了一定进展据了解,新版QQ在内存方面面临几个主要挑战。首先,产品形态相对复杂,由一个大面板和多个独立功能窗口构成,窗口与渲染进程一一对应,窗口进程数量对Electron的内存占用产生影响。如果不能对这个复杂的大面板进行精细控制,很容易导致内存持续增加。其次,用户习惯长时间挂机,相对于Web页面,QQ用户可能会挂机一个月以上,因此需要控制内存使用,避免内存持续

腾讯获得杭州亚运会转播权,电竞项目将于9月24日开始腾讯获得杭州亚运会转播权,电竞项目将于9月24日开始Sep 16, 2023 am 09:05 AM

本站9月15日消息,今天是杭州第19届亚运会倒计时第8天,腾讯集团宣布与中央广播电视总台达成合作,成为杭州亚运会持权转播商。腾讯集团宣布,杭州亚运会将于2023年9月23日至10月8日举行。届时,用户可以通过腾讯视频、腾讯体育、腾讯新闻、腾讯网、微信、微视、王者营地、和平营地、掌上英雄联盟、虎牙直播等平台观看亚运会的所有比赛转播和回放值得一提的是,腾讯旗下4大竞技项目将作为正式竞赛项目登上本次亚运会舞台。据本站此前报道,杭州亚运会的电竞赛事赛程已经出炉,电子竞技将作为智力项目于9月24日开赛,连

一文带你了解腾讯自主研发的通用大语言模型——混元大模型一文带你了解腾讯自主研发的通用大语言模型——混元大模型Sep 12, 2023 pm 08:21 PM

2023年9月7日上午,在腾讯全球数字生态大会上,腾讯集团高级执行副总裁、腾讯云与智慧产业事业群CEO汤道生宣布,腾讯将进入“全面拥抱大模型”时代,并同时宣布,腾讯自主研发的通用大语言模型——混元,正式向产业亮相。根据腾讯官方表示,混元大模型的中文能力已经超过GPT3.5发布后混元大模型将作为腾讯云MaaS服务的底座,用户可以通过腾讯云官网进行体验,并且支持直接调用API接口,也可可以将混元作为基底模型,并在公有云上根据企业的实际需求进行自定义调整。一、混元大模型简介二、计费方面腾讯混元大模型将

微信和腾讯地图升级“小修小补引路行动”,全国首张“一刻钟便民生活圈地图”上线微信和腾讯地图升级“小修小补引路行动”,全国首张“一刻钟便民生活圈地图”上线Nov 17, 2023 pm 02:45 PM

本站11月16日消息,微信和腾讯地图在今年发起了“小修小补引路行动”,展现出200多座城市的超50万家修补小店。在商务部指导下,“小修小补引路行动”全面升级,在微信搜一搜“小修小补”“修鞋”“修自行车”“裁缝”“修表”“修电器”“修锁”“配钥匙”“管道疏通”“修手机”等关键词,不仅可以直达小修小补便民主题地图,附近小店的信息都会直接标记出来,大大增加了小店的曝光率。“小修小补便民地图”小程序列出了每家小店的营业时间、具体地址以及联系电话等重要信息,方便用户更快找到小店。本站注意到,此前腾讯利用A

腾讯混元大模型正式亮相,我们抢先试了试它的生产力腾讯混元大模型正式亮相,我们抢先试了试它的生产力Sep 08, 2023 pm 07:57 PM

国内首批大型模型备案上周获批,开始向全社会开放服务,标志着大型模型进入了规模应用的新阶段。在之前发布应用的公司中,一些科技巨头似乎还没有行动在2023年9月7日,腾讯在腾讯全球数字生态大会上正式公开了混元大模型,并向外界开放了腾讯云作为一个超千亿参数的大模型,混元使用的预训练语料超过两万亿token,凭借多项独有的技术能力获得了强大的中文创作能力、复杂语境下的逻辑推理能力,以及可靠的任务执行能力。腾讯集团副总裁蒋杰表示:「腾讯混元大模型是从第一个token开始从零训练的,我们掌握了从模型算法到机

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software