RedHat6.5怎样装置MySQL?下面本篇文章就来给人人引见在RedHat6.5下装置MySQL5.7的要领,愿望对你们有所协助。
装置环境:
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?的细致内容,更多请关注ki4网别的相干文章!