CentOS65安装Mysql5.7.20
来源:互联网 发布:管碧玲 知乎 编辑:程序博客网 时间:2024/05/23 01:25
CentOS 6.5 下安装MySQL 5.7.12,使用官网下载的rpm安装包
下载安装包
下载地址:http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
这你可以参考:如何从官网下载MySQL最新版本的安装包?
解压安装包
1. tar -xvf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
移除已经安装的早期版本
如果不移除的话,会提示有冲突,版本可能有所不同
1.rpm -qa | grep -i mysql
mysql-libs-5.1.73-1.el6.x86_64
2. yum -y remove mysql-libs-5.1.73*
这个可以参考:
CentOS安装mysql*.rpm提示conflicts with file from package的解决办法
CentOS下如何完全卸载MySQL?解决卸载不干净的问题
安装顺序
1. rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm
2. rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm
3. rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm
4. rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm
5. rpm -ivh mysql-community-devel-5.7.12-1.el6.x86_64.rpm
启动Mysql服务
1. # service mysqld start
2. 初始化 MySQL 数据库: [确定]
3. Installing validate password plugin: [确定]
4. 正在启动 mysqld:
修改管理员密码
查看初始管理员密码
1. grep 'temporary password' /var/log/mysqld.log
1. # grep 'temporary password' /var/log/mysqld.log
2. 2017-11-08T10:52:43.963031Z 1 [Note] A temporary password is generated for root@localhost: _XetB9avyEYJ
3. [root@localhost /]#
4. [root@localhost /]# mysql -uroot -p_XetB9avyEYJ
5. mysql: [Warning] Using a password on the command line interface can be insecure.
6. Welcome to the MySQL monitor. Commands end with ; or \g.
7. Your MySQL connection id is 15
8. Server version: 5.7.12
9.
10. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
11.
12. Oracle is a registered trademark of Oracle Corporation and/or its
13. affiliates. Other names may be trademarks of their respective
14. owners.
15.
16. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
17.
18. mysql>
使用下面的命令修改密码
1. ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
2. update user set host = '%' where user = 'root'; -- 将root设为可以从任何机器登录
密码必须包含大写字母小写字母数字和符号,不然会提示:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements(您的密码不符合当前的安全策略要求)
授权远程登录
开启远程登录,授权远程登录用户:
1. grant all privileges on *.* to '用户名'@'%' identified by '密码' with grant option;
2. grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
或者
1. mysql -uroot -proot -e "grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;"
注意:命令前的“mysql -uroot -proot -e ”是直接在Shell下执行SQL语句,不登录mysql客户端。
使授权立即生效:
1. flush privileges;
或者
2. mysql -uroot -proot -e "flush privileges;"
如果不开启远程登录权限,将会遇到类似下面的错误:
在客户机上使用 Navicat for MySQL 远程连接就报10038的错
该问题的案例请参考:mysql远程报10038错误
连接MySQL错误:Can't connect to MySQL server (10060)
开放防火墙端口
添加需要监听的端口
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
注意:增加的开放3306端口的语句一定要在icmp-host-prohibited之前
保存设置
service iptables save
重启防火墙服务
service iptables restart
结束语
注意,使用 yum 安装的和使用rpm安装的有所不同(要么就是不同的版本安装后初始密码的位置不同),我记得之前安装完之后初始密码是保存在/root/.mysql_sercret 文件中的。
要在Windows下连接还需要做点工作,参考:CentOS下安装MySQL,Windows下使用Navicat for MySql连接
之前写过,这次又重新总结,发现还是存在着一些差异!
如果你在安装过程中发现、遇到了什么问题,欢迎一起探讨。
官网参考:http://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html
参考文档:
无知人生,记录点滴
CentOS 6.5 下安装MySQL 5.7.12,使用官网下载的rpm安装包
CentOS下如何完全卸载MySQL?解决卸载不干净的问题
CentOS安装mysql*.rpm提示conflicts with file from package的解决办法
CentOS6.5下通过Shell修改MySQL初始密码,开启远程登录,授权远程登录用户
mysql远程报10038错误
连接MySQL错误:Can't connect to MySQL server (10060)
- CentOS65安装Mysql5.7.20
- centos65安装jdk
- centos65 folly的编译安装
- Django 环境搭建(CentOS65 + Django1.7 + mySQL5.1)
- linux-centos65-jdk安装-亲测可用
- centos65 安装 脸书的proxygen
- centos65安装简测mysql cluster 7.3.7
- centos65安装pg935时报错: jade: Command not found
- MySQL5.7.20安装
- 安装mysql5.7.20版本
- 如何安装MySQL5.7.20
- MySQL5.7.20源码安装
- 安装mysql5.7.20
- linux安装MySQL5.7.20
- linux安装mysql5.7.20,亲测
- centos7下安装mysql5.7.20
- mysql5.7.20tar.gz安装
- 阿里云 安装mysql5.7.20
- 使用redis实现分布式锁(在集群环境下让任务排队执行)
- 1到10的平方和
- FPGA入门实验
- 五.从尾到头打印链表
- hdu 2544 最短路
- CentOS65安装Mysql5.7.20
- 基础练习 字母图形
- 轻松解决桌面或者开始菜单里的图标显示异常
- Kotlin学习(十七): 运算符重载
- 718. Maximum Length of Repeated Subarray
- 我们应该经常交流!
- MyBatis config 文件常用设置
- ACM
- Friends(老友记第一季词组)