RedHat6.5怎么安装MySQL?
RedHat6.5如何安置MySQL?下面本篇文章就来给大家介绍在RedHat6.5下安置MySQL5.7的办法,但愿对你们有所帮忙。
相关学习引荐:mysql教程
安置环境:
RedHat6.5
安置步骤:
第一步:下载
下载MySQL5.7:http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
第二步:安置
安置前检查效劳器可否已安置MySQL,如已安置则将其卸载:
[root@worker1 tmp]# rpm -qa|grep mysql mysql-libs-5.1.71-1.el6.x86_64 [root@worker1 tmp]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64 //卸载
将下载的文件停止解压:
[root@worker1 tmp]# tar -xf mysql-5.7.12-1.el6.x86_64.rpm-bundle.tar
按次序顺次安置:
rpm -ivh mysql-community-common-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-devel-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.12-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.12-1.el6.x86_64.rpm
不出不测,MySQL应当已经安置成功。
第三步:环境变量设定
1、启动MySQL:service mysqld start
2、登录:mysql -u root -p,初次登录密码为空,直接回车:
为什么会显现这个错误,缘由是由于MySQL5.7中的mysql.user 表中没有Password字段,所以要以平安方式登录,然后修改密码。
解决办法如下:
修改MySQL配置文件:vim /etc/my.cnf,在文件末尾加上:skip-grant-tables
,留存后重新启动MySQL效劳:service mysqld restart
,然后从新登录。
3、修改密码,会员密码是在名为mysql的database下面:
顺次施行以下指令:
mysql> use mysql mysql> update user set password_expired='N' where user='root'; mysql> update user set authentication_string=password('123456') where user=‘root'; mysql> flush privileges;
留意:必然要将my.cnf配置文件此前加的跳过密码检测内容去除,重新启动效劳;
其他:
1、编码设定:vim /etc/my.cnf
,文件末尾加上编码内容default-character-set=utf8
2、同意长途拜访MySQL: 给予任何主机拜访数据的权限
mysql>grant all privileges on . to ‘root'@'%'with grant option;
会报错:ERROR 1133 (42000): Can't find any matching row in the user table
其实假如事先在mysql.user表中存在root会员就正常了,或,将这句末尾加上identified by ‘密码' 也就正常了。如下面的命令行
mysql>grant all privileges on . to ‘root'@'%'identified by ‘123456' with grant option;
3、更换密码战略:
mysql> set global validate_password_length=0; --更换密码长度 mysql> set global validate_password_policy=0; --更换密码战略为LOW
以上就是RedHat6.5如何安置MySQL?的具体内容,更多请关注百分百源码网其它相关文章!