CentOS 6.5通過yum安裝mysql 5.5、5.6、5.7版本

來源:互聯網
上載者:User

標籤:yum安裝mysql   mysql5.5   mysql5.6   mysql5.7   

1、安裝mysql的yum源,這個源包括5.5、5.6、5.7版本:

備忘:如果要專門下載某個版本,可以到http://dev.mysql.com/downloads/repo/yum下載。

[[email protected] ~]# rpm -ivh http://repo.mysql.com/mysql-community-release-el6.rpmRetrieving http://repo.mysql.com/mysql-community-release-el6.rpmwarning: /var/tmp/rpm-tmp.C87LHo: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEYPreparing...                ########################################### [100%]   1:mysql-community-release########################################### [100%]


2、開啟mysql的yum源檔案,如果要安裝mysql哪個版本,選擇後把裡面的enable設定為1。

備忘:或者用yum-config-manager命令方式開啟或關閉。

yum-config-manager --disable mysql55-community
yum-config-manager --enable mysql56-community
yum-config-manager --disable mysql57-community

[[email protected] ~]#vim /etc/yum.repos.d/mysql-community.repo# Enable to use MySQL 5.5[mysql55-community]name=MySQL 5.5 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql# Enable to use MySQL 5.6[mysql56-community]name=MySQL 5.6 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql[mysql57-community]name=MySQL 5.7 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql


3、yum安裝mysql組件。

[[email protected] ~]#yum install mysql-community-client mysql-community-devel mysql-community-server php-mysql正在安裝: mysql-community-client                    x86_64               5.6.38-2.el6                 mysql56-community                18 M mysql-community-devel                     x86_64               5.6.38-2.el6                 mysql56-community               3.3 M mysql-community-libs                      x86_64               5.6.38-2.el6                 mysql56-community               1.9 M     replacing  mysql-libs.x86_64 5.1.73-8.el6_8 mysql-community-libs-compat               x86_64               5.6.38-2.el6                 mysql56-community               1.6 M     replacing  mysql-libs.x86_64 5.1.73-8.el6_8 mysql-community-server                    x86_64               5.6.38-2.el6                 mysql56-community                55 M php-mysql                                 x86_64               5.3.3-49.el6                 base                             86 k為依賴而安裝: mysql-community-common                    x86_64               5.6.38-2.el6                 mysql56-community               308 k numactl                                   x86_64               2.0.9-2.el6                  base                             74 k php-common                                x86_64               5.3.3-49.el6                 base                            530 k php-pdo                                   x86_64               5.3.3-49.el6                 base                             80 k


4、啟動mysql命令,並設定開機自啟動。

[[email protected] ~]#service mysqld start[[email protected] ~]#chkconfig mysqld on


5、mysql設定root密碼。

[[email protected] ~]#mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the currentpassword for the root user.  If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none): OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.Set root password? [Y/n] yNew password: Re-enter new password: Password updated successfully!Reloading privilege tables.. ... Success!By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] y ... Success!Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] y ... Success!By default, MySQL comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] y - Dropping test database...ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed!  Not critical, keep moving... - Removing privileges on test database... ... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] y ... Success!All done!  If you've completed all of the above steps, your MySQLinstallation should now be secure.Thanks for using MySQL!Cleaning up...


CentOS 6.5通過yum安裝mysql 5.5、5.6、5.7版本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.