Linux(redhat6.5)下 安装mysql5.7.18——yum方式
2017-07-07 02:04
393 查看
环境:redhat6.5,mysql5.7.18。
1,配置yum对mysql的支持
不同版本的mysql安装方式会有较大的差别详见最后
1,配置yum对mysql的支持
rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm[/code]
2,安装yumyum install yum-utils -y
3,启用mysql5.7的yum源yum-config-manager --disable mysql56-community yum-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 36 mysql-tools-community MySQL Tools Community 47 mysql57-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 0 sed -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,修改跳过授权验证方式启动MySQLmysqld_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,访问mysqlmysql
11,切换数据库use mysql;
12,修改密码update user set authentication_string=password('123456') where user='root';
13,使最新配置生效flush privileges;
14,测试[root@bogon ~]# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.18 Copyright (c) 2000, 2017, 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>
本机访问,通过。
以下是关于远程访问的配置↓
1,登录mysql并输入上述密码。
2,执行允许远程访问的sqlgrant 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
相关文章推荐
- linux6.5 redhat 安装centos 免注册的yum 源
- Linux下MySQL5.7.18 yum方式从卸载到安装过程图解
- Linux下MySQL5.7.18 yum方式从卸载到安装
- linux下安装mysql(centos6.5)-yum安装方式
- RedHat Enterprise Linux 5.0安装之ftp方式
- 让redhat5以yum方式安装软件
- LINUX安装mysql详解:yum方式,适合linux新手
- redhat6.5 安装 yum
- Linux中使用yum方式安装JDK
- CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin详细过程
- RedHat6.5 安装OpenStack all in one-RDO方式
- CentOS6.5和RedHat6.5下以rpm方式安装mysql-5.6.20
- linux (redhat)安装jdk,eclipse 及建立eclipse的快捷方式,且编译c++
- VMware虚拟机中安装Linux系统步骤(Redhat6.5)
- 【转】Red Hat Enterprise Linux Server release 6.5 安装yum 失败,依赖包,deltarpm = 3.5-0.5.20090913git.el6
- RedHat Enterprise Linux Server 5 在VMware Workstation6.5的详细安装过程
- RedHat Enterprise Linux Server 5 在VMware Workstation 6.5的详细安装过程(1)
- 在虚拟机 Linux redhat 5.4 x64 中安装yum 软件
- VMware9.0下采用默认方式安装的Redhat Enterprise Linux 5后配置vim支持中文
- Vmware Workstation 8.0.6&Redhat Enterprise Linux 6.4下安装yum工具及g++ 4.4.7