电脑疯子技术论坛|电脑极客社区

微信扫一扫 分享朋友圈

已有 1651 人浏览分享

Centos6.5 安装 MySQL5.6

[复制链接]
1651 0

Centos6.5 安装 MySQL5.6 or MySQL5.7 or 卸载MySQL

1.安装 MySQL5.6

  1. rpm -qa | grep mysql
  2. mysql-utilities-1.3.6-1.el6.noarch
  3. mysql-server-5.1.71-1.el6.x86_64
  4. mysql-libs-5.1.71-1.el6.x86_64
  5. mysql-5.1.71-1.el6.x86_64
  6. mysql-connector-python-1.1.4-1.el6.noarch
  7. mysql-devel-5.1.71-1.el6.x86_64
  8. yum remove mysql*
  9. yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
  10. yum install mysql mysql-devel mysql-server mysql-utilities
复制代码


2.安装 MySQL5.7

1).检测系统是否自带安装MySQL

yum list installed | grep mysql
2).删除系统自带的MySQL及其依赖 命令:

yum -y remove mysql-libs.x86_64

3).给CentOS添加rpm源,并且选择较新的源 命令

  1. wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
  2. yum localinstall mysql-community-release-el6-5.noarch.rpm
  3. yum repolist all | grep mysql
  4. yum-config-manager --disable mysql55-community
  5. yum-config-manager --disable mysql56-community
  6. yum-config-manager --enable mysql57-community-dmr
  7. yum repolist enabled | grep mysql
复制代码


4).安装MySql服务器 命令


yum install mysql-community-server
5).启动MySQL命令
service mysqld start
6).查看MySQL是否自启动,并且设置开启自启动 命令
chkconfig --list | grep mysqld
chkconfig mysqld on
7).MySQL安全设置 命令
mysql_secure_installation
mysql的默认配置文件一般在这几个文件里  [/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf ]

修改密码时一直报错:  ERROR 1819 (HY000): Your password does NOT satisfy the CURRENT policy requirements。  是因为MySQL5.6.6增加了密码强度验证插件validate_password,相关参数设置的较为严格,所以……  通过以下命令参数修改配置文件,然后重启服务即可

#
  1. [code] plugin env
  2.     plugin-load=validate_password.so
  3.     validate-password=OFF  # ON/OFF/... 设置为关闭
复制代码


使用免密码方式登录到mysql命令行窗口[/code]


  1. 8).
  2. [root@iZ250x18mnzZ myweb]# mysqld_safe --skip-grant-tables &
  3. [1] 26390
  4. [root@iZ250x18mnzZ myweb]# 2016-03-09T13:52:36.487526Z mysqld_safe Logging to '/var/log/mysqld.log'.
  5. 2016-03-09T13:52:36.519635Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
复制代码
  1. [root@iZ250x18mnzZ myweb]#
  2. [root@iZ250x18mnzZ myweb]# mysql
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.
  4. Your MySQL connection id is 2
  5. Server version: 5.7.11 MySQL Community Server (GPL)
复制代码
  1. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

  2. Oracle is a registered trademark of Oracle Corporation and/or its
  3. affiliates. Other names may be trademarks of their respective
  4. owners.

  5. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

  6. mysql>
复制代码


登录后修改密码


  1. mysql> update mysql.user set authentication_string=PASSWORD('password') where user='root' and host='localhost';
  2. Query OK, 1 row affected, 1 warning (0.05 sec)
  3. Rows matched: 1  Changed: 1  Warnings: 1

  4. mysql> flush privileges;
  5. Query OK, 0 rows affected (0.03 sec)
复制代码



3.Centos6.5 完全卸载MySQL


  1. yum remove mysql*
  2. yum list installed | grep mysql
  3. yum -y remove mysql-libs.x86_64
  4. yum remove  mysql mysql-server mysql-libs mysql-server
  5. find / -name mysql 将找到的相关东西delete掉
  6. rpm -qa|grep mysql(查询出来的东东yum remove掉)
  7. rm -rf mysql
复制代码



您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

关注

0

粉丝

9021

主题
精彩推荐
热门资讯
网友晒图
图文推荐

Powered by Pcgho! X3.4

© 2008-2022 Pcgho Inc.