redhat EL6.5安装mysql5.7及常见问题
2017-06-15 10:29
555 查看
环境:
redhat EL 6.5安装包下载:
mysql5.7下载解压安装:
安装前先查看系统有没有安装mysql,有的话,就卸载掉[root@server5 ~]# rpm -qa|grep mysql mysql-libs-5.1.71-1.el6.x86_64 [root@server5 ~]#rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps
也可以不卸载,将包 mysql-community-libs-compat-5.7.17-1.el6.x86_64.rpm 也安装上,它会替换掉低版本的 libs 库
解压下载包:
[root@server5 ~]# tar -xf mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar
解压完:
[root@server5 ~]# ls mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar mysql-community-client-5.7.17-1.el6.x86_64.rpm mysql-community-common-5.7.17-1.el6.x86_64.rpm mysql-community-devel-5.7.17-1.el6.x86_64.rpm mysql-community-embedded-5.7.17-1.el6.x86_64.rpm mysql-community-embedded-devel-5.7.17-1.el6.x86_64.rpm mysql-community-libs-5.7.17-1.el6.x86_64.rpm mysql-community-libs-compat-5.7.17-1.el6.x86_64.rpm mysql-community-server-5.7.17-1.el6.x86_64.rpm mysql-community-test-5.7.17-1.el6.x86_64.rpm
按顺序安装:
后一个包需要前面的依赖性
rpm -ivh mysql-community-common-5.7.17-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.17-1.el6.x86_64.rpm rpm -ivh mysql-community-devel-5.7.17-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.17-1.el6.x86_64.rpm #如果安装不了,需要依赖性,就用yum安装 #yum install -y mysql-community-server-5.7.17-1.el6.x86_64.rpm
启动:
/etc/init.d/mysqld start
与5.7之前的版本相比,5.7安装完之后是有一个自动生成的密码的
在日志文件 /var/log/mysqld.log 中
使用命令
cat /var/log/mysqld.log | grep temp
过滤一下就能得到密码
[root@server6 ~]# cat /var/log/mysqld.log | grep temp 2017-06-15T01:48:09.199189Z 1 [Note] A temporary password is generated for root@localhost: qf_c!Eev3pFH
我的默认密码是 qf_c!Eev3pFH
如果在看到密码之前日志文档被误删了,得不到密码,就要以安全方式登录,然后修改密码。
解决方法:
在配置文件里添加登陆不检测密码:
vim /etc/my.cnf
添加在最后一行
skip-grant-tables
重启服务,就能直接登陆了(不要密码登陆)
设置密码:
1.如果在日志文件里得到密码,就可以输入默认密码然后直接修改密码:[root@server6 ~]# mysql_secure_installation
2.如果密码忘记了,.通过上面安全方式登陆的mysql,可以进行如下方式修改.
用户密码是在名为mysql的database下面
登进数据库,依次执行下列命令:
mysql> use mysql; mysql> update user set password_expired='N' where user='root'; mysql> update user set authentication_string=password('redhat') where user='root'; mysql> flush privileges;
注意:
安全模式下设置完密码后,必须要把之前配置文件设置的跳过检测密码去掉,然后重启服务自此,mysql5.7 就安装成功了.
测试:
登陆成功:[root@server5 ~]# mysql -uroot -predhat mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.7.17 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> quit Bye
mysql5.7设置了自动检测密码强度,已经设过的密码不能再使用,设的密码必须包括大小写,数字,特殊字符,长度必须大于等于8位.
不过可以更改密码强度(临时的,在退出数据库后,下次要设置简单密码,还要重新输入这几条命令,已经设置的永久生效):
如果要永久更改密码强壮度,要安装一个插件.
解决方法:
mysql> set global validate_password_policy=0; #更改密码强度 mysql> < a627 span class="hljs-built_in">set global validate_password_length=0; #更改密码长度
改完之后,就行了:
mysql> GRANT REPLICATION SLAVE,RELOAD,SUPER ON *.* TO mysql@'172.25.12.5' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected, 1 warning (0.31 sec)
相关文章推荐
- RedHat6.5安装MySQL5.6及卸载MySQL5.6(安装卸载过程及常见问题解决)
- [阿里云] Linux CentOS 7.4 环境下安装 MySql5.7 完整流程以及常见问题的解决方法
- redhat6.5安装cacti监控及安装过程中的问题解决
- Mysql5.7解压版的安装和卸载及常见问题
- Mysql5.7解压版的安装和卸载及常见问题
- RedHat6.5安装MySQL5.7
- redhat安装mysql常见问题
- redhat6.5安装pip问题及解决
- Mysql5.7解压版的安装和卸载及常见问题小结
- MySQL5.7安装教程及常见问题解决
- mysql5.7安装配置,常用命令,常见问题
- VMware workstation安装Redhat EL 5.5系统和Oracle 11g R2遇到的一些问题
- VMware6.5安装redhat鼠标及网络问题解决日志
- [置顶] Mysql5.7解压版的安装和卸载及常见问题
- vm6.5安装redhat时遇到的问题
- Windows下mysql5.7.X 解压缩版正确安装步骤以及常见问题
- was6.1在linux(redhat5)上静默安装与常见问题解决
- Mysql5.7解压版的安装和卸载及常见问题
- RedHat6.5安装MySQL5.7
- RedHat6.5安装MySQL5.7