您的位置:首页 > 运维架构 > Linux

CentOS6.5安装mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar

2017-06-16 11:11 751 查看
先去官网(https://dev.mysql.com/downloads/mysql/),在Select Operating System选择Red Hat Enterprise Linux / Oracle Linux,在Select OS Version选择Red Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 64-bit),下载RPM Bundle

将下载的文件上传到服务器/usr/local下,接着执行如下命令

rpm -qa|grep mysql #查看mysql是否安装,如果已经安装需要卸载,如果是
yum -y remove mysql-libs-5.1.71-1.el6.x86_64
#卸载
cd /usr/local/ #指定目录
tar -xvf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar
#解压
rpm -ivh mysql-community-common-5.7.18-1.el6.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.18-1.el6.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm
yum install perl #安装server时需要的依赖包
yum install numactl #安装server时需要的依赖包
yum install libaio #安装时需要的依赖包
rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm
service mysqld start #启动mysqld服务
netstat -tlunp #查看服务所需端口
cat /var/log/mysqld.log | more #查看日志,找初始密码
cat /etc/issue #查看系统版本
getconf LONG_BIT #查看系统位数


如下所示

2017-06-16T04:48:19.788616Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-16T04:48:22.099994Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-06-16T04:48:22.332387Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-16T04:48:22.405922Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 068f9e70-524f-11e7-80fb-000c297c9986.
2017-06-16T04:48:22.409115Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-16T04:48:22.410417Z 1 [Note] A temporary password is generated for root@localhost: dee5h,lqSA>)


接着执行如下命令

mysql -uroot -pdee5h,lqSA>)
alter user 'root'@'localhost' identified by 'Mysql@123456'; #设置root的密码为Mysql@123456
use mysql;
update user set user.Host='%' where user.User='root';
flush privileges;
exit;
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT #配置端口3306
/etc/rc.d/init.d/iptables save #保存配置
/etc/init.d/iptables restart #重启防火墙iptables
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: