Linux system-How to install MySQL in CentOS7.2

Source: Internet
Author: User

One, the different versions of Mysql:
1.MySQL Community Server Community version , open source free, but does not provide official technical support.
2,MySQL Enterprise Edition Business version , pay, you can try 30 days.
3,MySQL Cluster cluster version , open source free. Several MySQL servers can be packaged as one server.
4.MySQL Cluster CGE Premium Cluster edition , fees apply.
5.MySQL Workbench(GUI tool) a er/database modeling tool designed for MySQL. It is a successor to the famous database design tool DBDesigner4.
MySQL Workbench is also divided into two versions, namely the Community Edition (MySQL Workbench OSS), the Business Edition (MySQL Workbench SE).

MySQL Community Server is open source free, which is also the version of MySQL we usually use. Subdivided into multiple versions based on different operating system platforms,
Second, to suit their own system to select the corresponding version to install:


Because my system is centos7, everyone who knows about Linux system versions should know how to choose (Go to the download page for MySQL Yum repository at http://dev.mysql.com/ downloads/repo/yum/.), here I choose MySQL Yum Repository
Click to enter (the first red box is the detailed installation method step, the second red box is required rpm file)


Click the first red box to have the appropriate installation method and command statements, but all in English, here I only briefly explain

1.shell> sudo rpm -Uvh platform-and-version-specific-package-name.rpm #找到刚才下载的rpm指定路径,敲下上述代码即可
        
 Eg:刚才我下的是" mysql57-community-release-el7-9.noarch.rpm ",敲下"sudo rmp –Uvh mysql57-community-release-el7-9.noarch.rpm "即可

2.shell> yum repolist all | grep mysql #列出MySQL的一系列版本(其中有最新的,也有旧的)

你可以在/etc/yum.repos.d/mysql-community.repo编辑,选择自己需要的版本,下面是一个例子
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[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


上面有5.6版和5.7版,(enabled=0表示不安装,enabled=0表示安装)
如果只想安装5.6版(将5.7版下面的enabled的值改为0)
    如果只想安装5.7版(将5.6版下面的enabled的值改为0) 

要想验证刚才修改的到底安装什么版本,重复执行
shell> yum repolist enabled | grep mysql 即可看见

对于新手来说觉得麻烦的话,完全可以跳过步骤2(因为默认是安装最新版本的)

3. shell> sudo yum install mysql-community-server #安装MySQL
4. shell> sudo service mysqld start #启动mysql服务

5. shell> sudo service mysqld status #查看mysql的状态,看是否actived

 6.shell> sudo grep ‘temporary password‘ /var/log/mysqld.log #生成一个临时密码,便于访问mysql

7. shell> mysql -uroot -p #生成一个账户,用第6步的临时密码登录
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘; #应该是创建用户‘root‘@‘localhost‘和密码吧。


ps:后面的一些步骤,大家也可以上官网查看,翻译起来太费劲了

.

Linux system-How to install MySQL in CentOS7.2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.