Centos6.5 安装 MySQL5.6 or MySQL5.7 or 卸载MySQL
1.安装 MySQL5.6
- rpm -qa | grep mysql
- mysql-utilities-1.3.6-1.el6.noarch
- mysql-server-5.1.71-1.el6.x86_64
- mysql-libs-5.1.71-1.el6.x86_64
- mysql-5.1.71-1.el6.x86_64
- mysql-connector-python-1.1.4-1.el6.noarch
- mysql-devel-5.1.71-1.el6.x86_64
- yum remove mysql*
- yum install http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
- 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源,并且选择较新的源 命令
- wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
- yum localinstall mysql-community-release-el6-5.noarch.rpm
- yum repolist all | grep mysql
- yum-config-manager --disable mysql55-community
- yum-config-manager --disable mysql56-community
- yum-config-manager --enable mysql57-community-dmr
- 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,相关参数设置的较为严格,所以…… 通过以下命令参数修改配置文件,然后重启服务即可
#- [code] plugin env
- plugin-load=validate_password.so
- validate-password=OFF # ON/OFF/... 设置为关闭
复制代码
使用免密码方式登录到mysql命令行窗口[/code]
- 8).
- [root@iZ250x18mnzZ myweb]# mysqld_safe --skip-grant-tables &
- [1] 26390
- [root@iZ250x18mnzZ myweb]# 2016-03-09T13:52:36.487526Z mysqld_safe Logging to '/var/log/mysqld.log'.
- 2016-03-09T13:52:36.519635Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
复制代码- [root@iZ250x18mnzZ myweb]#
- [root@iZ250x18mnzZ myweb]# mysql
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 2
- Server version: 5.7.11 MySQL Community Server (GPL)
复制代码- Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- mysql>
复制代码
登录后修改密码
- mysql> update mysql.user set authentication_string=PASSWORD('password') where user='root' and host='localhost';
- Query OK, 1 row affected, 1 warning (0.05 sec)
- Rows matched: 1 Changed: 1 Warnings: 1
- mysql> flush privileges;
- Query OK, 0 rows affected (0.03 sec)
复制代码
3.Centos6.5 完全卸载MySQL
- yum remove mysql*
- yum list installed | grep mysql
- yum -y remove mysql-libs.x86_64
- yum remove mysql mysql-server mysql-libs mysql-server
- find / -name mysql 将找到的相关东西delete掉
- rpm -qa|grep mysql(查询出来的东东yum remove掉)
- rm -rf mysql
复制代码
|