linux 安装 mysql 5.7二进制文件

实践环境:
centos 6.9
mysql mysql-5.7.20-linux-glibc2.12-x86_64

参考资料:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

按需要安装所需要软件
yum 安装
> yum search libaio  # search for info
> yum install libaio # install library
apt 安装
> apt-cache search libaio # search for info
> apt-get install libaio1 # install library

1、解压到你需要的安装目录一般在 /use/local/mysql,不是这个目录时需要自行处理链接快捷 socket,参考:http://binary-space.iteye.com/blog/2203617
2、cd 到解压目录
3、创建mysql 组与用户
> groupadd mysql
> useradd -r -g mysql -s /bin/false mysql
4、按需要设置权限
5、安装
> bin/mysqld --initialize --user=mysql
提示信息
2018-01-04T06:48:24.652569Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-01-04T06:48:24.881794Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-01-04T06:48:25.097948Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-01-04T06:48:25.357248Z 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: 434c44cb-f11b-11e7-b768-005056a5b865.
2018-01-04T06:48:25.357880Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-01-04T06:48:25.358546Z 1 [Note] A temporary password is generated for root@localhost: QRdOjg,Y<0Hk
QRdOjg,Y<0Hk 为初始密码
也可用下面的命令获取初始密码:
>grep 'temporary password' /var/log/mysqld.log
6、启动
./support-files/mysql.server start
7、登录
>./bin/mysql -u 【用户名】 -p【密码】
8、首次登录重设密码
> Alter user 'root'@'localhost' identified by 'i-Sprint2011';
9、远程连接需要可能需要关闭防火墙
添加需要监听的端口
>/sbin/iptables -I【是i,需要删除这个中括号】 INPUT -p tcp --dport 3306 -j ACCEPT
保存设置
>/etc/init.d/iptables save
查看状态
>/etc/init.d/iptables status

注:连接登录 mysql 如果报错请参照博文:
http://binary-space.iteye.com/blog/2412768


--------------------------------------------------------------------
若有其他凝问或文中有错误,请及时向我指出,
我好及时改正,同时也让我们一起进步。
email : [email protected]
qq     : 1035862795
敲门砖: 代码谱写人生








猜你喜欢

转载自binary-space.iteye.com/blog/2406637