设为首页 收藏本站
查看: 458|回复: 0

[经验分享] Centos6快速安装mysql 5.6

[复制链接]

尚未签到

发表于 2018-9-29 13:26:53 | 显示全部楼层 |阅读模式
一、检查系统是否安装其他版本的MYSQL数据[root@msyql-01 ~]# yum list installed | grep mysql  mysql-libs.x86_64       5.1.73-8.el6_8  @anaconda-CentOS-201703281317.x86_64/6.9
  [root@msyql-01 ~]# yum -y remove mysql-libs.x86_64
  Loaded plugins: fastestmirror, security
  Setting up Remove Process
  Resolving Dependencies
  --> Running transaction check
  ---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be erased
  --> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-8.el6.x86_64
  --> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-8.el6.x86_64
  --> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-8.el6.x86_64
  --> Running transaction check
  ---> Package postfix.x86_64 2:2.6.6-8.el6 will be erased
  --> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-16.el6_8.2.x86_64
  --> Running transaction check
  ---> Package cronie.x86_64 0:1.4.4-16.el6_8.2 will be erased
  --> Processing Dependency: cronie = 1.4.4-16.el6_8.2 for package: cronie-anacron-1.4.4-16.el6_8.2.x86_64
  --> Running transaction check
  ---> Package cronie-anacron.x86_64 0:1.4.4-16.el6_8.2 will be erased
  --> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-33.el6.x86_64
  --> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
  --> Restarting Dependency Resolution with new changes.
  --> Running transaction check
  ---> Package crontabs.noarch 0:1.10-33.el6 will be erased
  ---> Package sysstat.x86_64 0:9.0.4-33.el6 will be erased
  --> Finished Dependency Resolution
  Dependencies Resolved
  ==================================================================================================================================================================
  Package                          Arch                     Version                               Repository                                                  Size
  ==================================================================================================================================================================
  Removing:
  mysql-libs                       x86_64                   5.1.73-8.el6_8                        @anaconda-CentOS-201703281317.x86_64/6.9                   4.0 M
  Removing for dependencies:
  cronie                           x86_64                   1.4.4-16.el6_8.2                      @anaconda-CentOS-201703281317.x86_64/6.9                   174 k
  cronie-anacron                   x86_64                   1.4.4-16.el6_8.2                      @anaconda-CentOS-201703281317.x86_64/6.9                    43 k
  crontabs                         noarch                   1.10-33.el6                           @anaconda-CentOS-201703281317.x86_64/6.9                   2.4 k
  postfix                          x86_64                   2:2.6.6-8.el6                         @anaconda-CentOS-201703281317.x86_64/6.9                   9.7 M
  sysstat                          x86_64                   9.0.4-33.el6                          @anaconda-CentOS-201703281317.x86_64/6.9                   826 k
  Transaction Summary
  ==================================================================================================================================================================
  Remove        6 Package(s)

  Installed>  Downloading Packages:
  Running rpm_check_debug
  Running Transaction Test
  Transaction Test Succeeded
  Running Transaction
  Erasing    : sysstat-9.0.4-33.el6.x86_64                                                                                                                    1/6
  Erasing    : cronie-1.4.4-16.el6_8.2.x86_64                                                                                                                 2/6
  Erasing    : cronie-anacron-1.4.4-16.el6_8.2.x86_64                                                                                                         3/6
  Erasing    : crontabs-1.10-33.el6.noarch                                                                                                                    4/6
  Erasing    : 2:postfix-2.6.6-8.el6.x86_64                                                                                                                   5/6
  Erasing    : mysql-libs-5.1.73-8.el6_8.x86_64                                                                                                               6/6
  Verifying  : cronie-anacron-1.4.4-16.el6_8.2.x86_64                                                                                                         1/6
  Verifying  : cronie-1.4.4-16.el6_8.2.x86_64                                                                                                                 2/6
  Verifying  : 2:postfix-2.6.6-8.el6.x86_64                                                                                                                   3/6
  Verifying  : crontabs-1.10-33.el6.noarch                                                                                                                    4/6
  Verifying  : sysstat-9.0.4-33.el6.x86_64                                                                                                                    5/6
  Verifying  : mysql-libs-5.1.73-8.el6_8.x86_64                                                                                                               6/6
  Removed:
  mysql-libs.x86_64 0:5.1.73-8.el6_8
  Dependency Removed:
  cronie.x86_64 0:1.4.4-16.el6_8.2        cronie-anacron.x86_64 0:1.4.4-16.el6_8.2        crontabs.noarch 0:1.10-33.el6        postfix.x86_64 2:2.6.6-8.el6
  sysstat.x86_64 0:9.0.4-33.el6
  Complete!
二、安装及配置  [root@msyql-01 ~]# yum list installed | grep mysql
  [root@msyql-01 ~]# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
  --2018-04-23 01:23:56--  http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
  Resolving repo.mysql.com... 23.50.239.110
  Connecting to repo.mysql.com|23.50.239.110|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 5824 (5.7K) [application/x-redhat-package-manager]
  Saving to: “mysql-community-release-el6-5.noarch.rpm”
  100%[========================================================================================================================>] 5,824       --.-K/s   in 0s
  2018-04-23 01:23:57 (190 MB/s) - “mysql-community-release-el6-5.noarch.rpm” saved [5824/5824]
  [root@msyql-01 ~]# ll
  total 48
  -rw-------. 1 root root  1139 Apr 19 23:22 anaconda-ks.cfg
  -rw-r--r--. 1 root root 21736 Apr 19 23:22 install.log
  -rw-r--r--. 1 root root  5890 Apr 19 23:20 install.log.syslog
  -rw-r--r--. 1 root root  5824 Nov 12  2015 mysql-community-release-el6-5.noarch.rpm
  [root@msyql-01 ~]# rpm -ivh mysql-community-release-el6-5.noarch.rpm
  Preparing...                ########################################### [100%]
  1:mysql-community-release########################################### [100%]
  [root@msyql-01 ~]# ll
  total 48
  -rw-------. 1 root root  1139 Apr 19 23:22 anaconda-ks.cfg
  -rw-r--r--. 1 root root 21736 Apr 19 23:22 install.log
  -rw-r--r--. 1 root root  5890 Apr 19 23:20 install.log.syslog
  -rw-r--r--. 1 root root  5824 Nov 12  2015 mysql-community-release-el6-5.noarch.rpm
  [root@msyql-01 ~]# yum repolist all | grep mysql
  mysql-connectors-community        MySQL Connectors Community      enabled:    49
  mysql-connectors-community-source MySQL Connectors Community - So disabled
  mysql-tools-community             MySQL Tools Community           enabled:    61
  mysql-tools-community-source      MySQL Tools Community - Source  disabled
  mysql55-community                 MySQL 5.5 Community Server      disabled
  mysql55-community-source          MySQL 5.5 Community Server - So disabled
  mysql56-community                 MySQL 5.6 Community Server      enabled:   434
  mysql56-community-source          MySQL 5.6 Community Server - So disabled
  mysql57-community-dmr             MySQL 5.7 Community Server Deve disabled
  mysql57-community-dmr-source      MySQL 5.7 Community Server Deve disabled
安装MYSQL数据库  [root@msyql-01 ~]# yum install mysql-community-server -y
  Loaded plugins: fastestmirror, security
  Setting up Install Process
  Loading mirror speeds from cached hostfile
  * base: mirrors.tuna.tsinghua.edu.cn
  * extras: mirror.bit.edu.cn
  * updates: mirror.bit.edu.cn
  Resolving Dependencies
  --> Running transaction check
  ---> Package mysql-community-server.x86_64 0:5.6.40-2.el6 will be installed
  --> Processing Dependency: mysql-community-common(x86-64) = 5.6.40-2.el6 for package: mysql-community-server-5.6.40-2.el6.x86_64
  --> Processing Dependency: mysql-community-client(x86-64) >= 5.6.10 for package: mysql-community-server-5.6.40-2.el6.x86_64
  --> Processing Dependency: perl(DBI) for package: mysql-community-server-5.6.40-2.el6.x86_64
  --> Running transaction check
  ---> Package mysql-community-client.x86_64 0:5.6.40-2.el6 will be installed
  --> Processing Dependency: mysql-community-libs(x86-64) >= 5.6.10 for package: mysql-community-client-5.6.40-2.el6.x86_64
  ---> Package mysql-community-common.x86_64 0:5.6.40-2.el6 will be installed
  ---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
  --> Running transaction check
  ---> Package mysql-community-libs.x86_64 0:5.6.40-2.el6 will be installed
  --> Finished Dependency Resolution
  Dependencies Resolved
  ==================================================================================================================================================================
  Package                                       Arch                          Version                               Repository                                Size
  ==================================================================================================================================================================
  Installing:
  mysql-community-server                        x86_64                        5.6.40-2.el6                          mysql56-community                         55 M
  Installing for dependencies:
  mysql-community-client                        x86_64                        5.6.40-2.el6                          mysql56-community                         18 M
  mysql-community-common                        x86_64                        5.6.40-2.el6                          mysql56-community                        308 k
  mysql-community-libs                          x86_64                        5.6.40-2.el6                          mysql56-community                        1.9 M
  perl-DBI                                      x86_64                        1.609-4.el6                           base                                     705 k
  Transaction Summary
  ==================================================================================================================================================================
  Install       5 Package(s)

  Total download>
  Installed>  Downloading Packages:
  (1/5): mysql-community-client-5.6.40-2.el6.x86_64.rpm                                                                                      |  18 MB     00:33
  (2/5): mysql-community-common-5.6.40-2.el6.x86_64.rpm                                                                                      | 308 kB     00:00
  (3/5): mysql-community-libs-5.6.40-2.el6.x86_64.rpm                                                                                        | 1.9 MB     00:03
  (4/5): mysql-community-server-5.6.40-2.el6.x86_64.rpm                                                                                      |  55 MB     02:55
  (5/5): perl-DBI-1.609-4.el6.x86_64.rpm                                                                                                     | 705 kB     00:01
  ------------------------------------------------------------------------------------------------------------------------------------------------------------------
  Total                                                                                                                             358 kB/s |  75 MB     03:35

  warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key>  Retrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
  Importing GPG key 0x5072E1F5:

  Userid : MySQL>  Package: mysql-community-release-el6-5.noarch (installed)
  From   : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

  warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key>  Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  Importing GPG key 0xC105B9DE:
  Userid : CentOS-6 Key (CentOS 6 Official Signing Key)
  Package: centos-release-6-9.el6.12.3.x86_64 (@anaconda-CentOS-201703281317.x86_64/6.9)
  From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  Running rpm_check_debug
  Running Transaction Test
  Transaction Test Succeeded
  Running Transaction
  Warning: RPMDB>  Installing : mysql-community-common-5.6.40-2.el6.x86_64                                                                                                     1/5
  Installing : mysql-community-libs-5.6.40-2.el6.x86_64                                                                                                       2/5
  Installing : mysql-community-client-5.6.40-2.el6.x86_64                                                                                                     3/5
  Installing : perl-DBI-1.609-4.el6.x86_64                                                                                                                    4/5
  Installing : mysql-community-server-5.6.40-2.el6.x86_64                                                                                                     5/5
  Verifying  : mysql-community-client-5.6.40-2.el6.x86_64                                                                                                     1/5
  Verifying  : mysql-community-common-5.6.40-2.el6.x86_64                                                                                                     2/5
  Verifying  : mysql-community-libs-5.6.40-2.el6.x86_64                                                                                                       3/5
  Verifying  : mysql-community-server-5.6.40-2.el6.x86_64                                                                                                     4/5
  Verifying  : perl-DBI-1.609-4.el6.x86_64                                                                                                                    5/5
  Installed:
  mysql-community-server.x86_64 0:5.6.40-2.el6
  Dependency Installed:
  mysql-community-client.x86_64 0:5.6.40-2.el6          mysql-community-common.x86_64 0:5.6.40-2.el6          mysql-community-libs.x86_64 0:5.6.40-2.el6
  perl-DBI.x86_64 0:1.609-4.el6
  Complete!
设置为开机启动(2、3、4都是on代表开机自动启动)[root@msyql-01 ~]# chkconfig --list | grep mysqld  mysqld         0:off1:off2:off3:on4:on5:on6:off
  [root@msyql-01 ~]# chkconfig mysqld on
  [root@msyql-01 ~]# chkconfig --list | grep mysqld
  mysqld         0:off1:off2:on3:on4:on5:on6:off
三、设置远程root  启动mysql
# service mysqld start设置root密码# mysql_secure_installation登陆root账号# mysql -uroot -p建立远程root用户mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'>mysql> flush privileges;
四、设置utf-8编码  查看mysql原本编码:
mysql> show variables like 'character%';设置编码# vi /etc/my.cnf如下(少补):
[mysqld]  
character-set-server=utf8
  
collation-server=utf8_general_ci
  
sql_mode='NO_ENGINE_SUBSTITUTION'
  [mysql]
  
default-character-set = utf8
  

  
[mysql.server]
  
default-character-set = utf8
  

  

  
[mysqld_safe]
  
default-character-set = utf8
  

  

  
[client]
  
default-character-set = utf8

  重启mysql
# service mysqld restart  再次查看编码:

     # mysql -uroot -p  mysql> show variables like 'character%';
  +--------------------------+----------------------------+
  | Variable_name | Value |
  +--------------------------+----------------------------+
  | character_set_client | utf8 |
  | character_set_connection | utf8 |
  | character_set_database | utf8 |
  | character_set_filesystem | binary |
  | character_set_results | utf8 |
  | character_set_server | utf8 |
  | character_set_system | utf8 |
  | character_sets_dir | /usr/share/mysql/charsets/ |
  +--------------------------+----------------------------+
  8 rows in set (0.00 sec)




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-603859-1-1.html 上篇帖子: Centos6.2+Open***+Radius+Mysql+daloRADIUS 下篇帖子: mysql5.7——innodb存储引擎总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表