Linux(redhat6.5)下 安装mysql5.7.18——yum方式
来源:互联网 发布:黄金利多利空数据软件 编辑:程序博客网 时间:2024/06/05 08:13
环境:redhat6.5,mysql5.7.18。
不同版本的mysql安装方式会有较大的差别详见最后
1,配置yum对mysql的支持
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
2,安装yum
yum install yum-utils -y
3,启用mysql5.7的yum源
yum-config-manager --disable mysql56-communityyum-config-manager --enable mysql57-community-dmr
4,验证将要安装的yum源
yum repolist enabled | grep mysql
如果显示
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.mysql-connectors-community MySQL Connectors Community 36mysql-tools-community MySQL Tools Community 47mysql57-community-dmr MySQL 5.7 Community Server Development Milesto 183
则证明设置成功!
5,执行安装
yum install mysql-community-server
一路确认(Y),下载相关依赖rpm,下载需要一定时间 ,执行安装。
(1/5): mysql-community-client-5.7.18-1.el6.x86_64.rpm | 23 MB 01:14 (2/5): mysql-community-common-5.7.18-1.el6.x86_64.rpm | 328 kB 00:01 (3/5): mysql-community-libs-5.7.18-1.el6.x86_64.rpm | 2.1 MB 00:06 (4/5): mysql-community-libs-compat-5.7.18-1.el6.x86_64.rpm | 1.6 MB 00:05 (5/5): mysql-community-server-5.7.18-1.el6.x86_64.rpm (53%) 45% [================================================ ] 331 kB/s | 68 MB 04:18 ETA
提示
Complete!
安装完成。
6,禁用selinux(没有理解)
setenforce 0sed -i '/^SELINUX=/c\SELINUX=disabled' /etc/selinux/config
7,第一次启动服务(会初始化ROOT用户数据)
service mysqld start
此时输入mysql提示
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
8,停止MySQL服务
service mysqld stop
9,修改跳过授权验证方式启动MySQL
mysqld_safe --skip-grant-tables
如果提示
2017-07-11T00:56:58.195385Z mysqld_safe Logging to '/var/log/mysqld.log'.2017-07-11T00:56:58.207820Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
则证明可以不输入密码访问mysql
10,访问mysql
mysql
11,切换数据库
use mysql;
12,修改密码
update user set authentication_string=password('123456') where user='root';
13,使最新配置生效
flush privileges;
14,测试
[root@bogon ~]# mysql -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.18Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
本机访问,通过。
以下是关于远程访问的配置↓
1,登录mysql并输入上述密码。
2,执行允许远程访问的sql
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
此时会提示
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
3,需要再一次重新设置密码(崩溃!)
SET PASSWORD = PASSWORD('12345678');
4,再次执行2
5,更新配置
flush privileges;
6,退出mysql。
7,永久关闭防火墙。
chkconfig iptables off
8,重启
reboot
9,测试
写在最后的一些细节问题:
1,mysql5.6是不会生成mysql_secret文件,可以直接登录。
2,mysql5.7.x - mysql5.7.7之间是生成mysql_secret文件 初始密码在这里面(/root/.mysql_secret)。
3,mysql5.7.7之后没有mysql_secret文件,密码在/var/log/mysqld.log(仔细找)。
4,可以不去找/var/log/mysqld.log,但是要去修改跳过授权验证方式启动MySQL,修改root(mysql的root)密码。
5,5.7之后密码字段的column为authentication_string而不是password。
6,如果提示
Your password does not satisfy the current policy requirements
参考
http://www.cnblogs.com/ivictor/p/5142809.html
- Linux(redhat6.5)下 安装mysql5.7.18——yum方式
- redhat6.5下配置安装yum源
- redhat6.5 安装 yum
- CentOS6.5下以yum方式安装MySQL5.5
- RedHat6.5安装MySQL5.7
- RedHat6.5安装MySQL5.7
- 笔记:Linux下yum安装mysql5.7
- RedHat6.0下源码安装MySQL5.5.27
- RedHat6下源码安装MySQL5.6
- 在Linux RedHat6.5下配置yum源
- linux(centos6.8 64位)下安装mysql5.7(yum方式)
- linux——(7)基于redhat6.4的本地yum和ftp yum源配置
- redhat6.3系统下的kscope1.6.2安装——RHEL6.3 本地创建YUM源
- linux基础——在redhat6下配置yum源的使用
- centos6.5下yum安装mysql5.5
- mysql5.7 Yum方式安装
- Redhat6.5二进制安装mysql5.7.9(详细)
- 环境——卸载redhat6.5的yum,安装centos6的yum,配置第三房yum源
- [leetcode 50. Pow(x, n)]week 11
- [leetcode 19 Remove Nth Node From End of List]week 13
- 两类strling数
- [leetcode Merge Two Sorted Lists]week 15
- [leetcode Search Insert Position]week 17
- Linux(redhat6.5)下 安装mysql5.7.18——yum方式
- [leetcode Best Time to Buy and Sell Stock]week 18
- [leetcode Maximum Subarray]week 19
- 线性表(List)---顺序存储结构
- [算法概论 8.12 k-生成树问题]
- zoj 2271
- 3625 Examining the Rooms(第一类strling数)
- 数论模板
- uva 10976 分数拆分