mysql-5.7.17-linux-glibc2.5 的免编译安装

1 . 从官网下载 mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
2.检查你所用的Linux下有没有安装过mysql,没有卸载干净
rpm -q mysql
3. 卸载mysql
rpm -e mysql --nodeps
4. 创建mysql的用户和组
useradd  mysql
5. 解压 mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
tar zxf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
6. 移动解压后的问价并重新命名为mysql
mv mysql-5.7.17-linux-glibc2.5-x86_64 /usr/local/mysql
7. 更改属主属组
chown -R  mysql:mysql /usr/local/mysql/
8.进入/usr/local/mysql, 并初始化数据库
cd   /usr/local/mysql

./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize

2018-01-17T07:41:02.340159Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-01-17T07:41:02.340257Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2018-01-17T07:41:02.340264Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2018-01-17T07:41:02.804107Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-01-17T07:41:02.876235Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-01-17T07:41:02.939354Z 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: c4bbd03c-fb59-11e7-87f7-5254002afcc1.
2018-01-17T07:41:02.942346Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-01-17T07:41:02.943669Z 1 [Note] A temporary password is generated for root@localhost: k!lGGrWng3qP

上面结果最后一个是mysql的初始密码

9. 启动mysql
 ./support-files/mysql.server start

启动mysql数据库服务。

10.创建软连接
ln -s /usr/local/mysql/bin/mysql   /usr/bin/mysql

客户端命令操作需要用到。

11. 创建配置文件并添加服务端启动脚本到系统启动脚本
cp  /usr/local/mysql/support-files/my-default.cnf   /etc/my.cnf
cp  /usr/local/mysql/support-files/mysql.server     /etc/init.d/mysqld
chmod 755   /etc/init.d/mysqld

重启mysql 即可安装成功。

    原文作者:你清澈又神秘
    原文地址: https://www.jianshu.com/p/ad4d29149add
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞