网站建设的原则,网站程序开发,静态网站开发与实施的论文,网站建设相对路径一、准备阶段通常情况下#xff0c;MySQL在CentOS下主要使用glibc、rpm、yum等方式进行安装#xff0c;使用mysql-5.7.21-el7-x86_64.tar.gz包进行安装的很少见#xff0c;网上资料也较少。通过一上午的摸索#xff0c;总结出如下安装方法。下载安装包#xff1a;[rootGee…一、准备阶段通常情况下MySQL在CentOS下主要使用glibc、rpm、yum等方式进行安装使用mysql-5.7.21-el7-x86_64.tar.gz包进行安装的很少见网上资料也较少。通过一上午的摸索总结出如下安装方法。下载安装包[rootGeekDevOps ~]# curl -C - -O https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-el7-x86_64.tar.gz% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed100 674M 100 674M 0 0 4311k 0 0:02:40 0:02:40 --:--:-- 4067k创建安装账户[rootGeekDevOps ~]# useradd -s /bin/false -d /usr/local/mysql mysql[rootGeekDevOps ~]# id mysqluid1000(mysql) gid1000(mysql) 组1000(mysql)二、安装过程[rootGeekDevOps ~]# tar -xvzf mysql-5.7.21-el7-x86_64.tar.gz -C /usr/local/mysql/[rootGeekDevOps mysql]# cd /usr/local/mysql/mysql-5.7.21-el7-x86_64/[rootGeekDevOps mysql-5.7.21-el7-x86_64]# mv * ../[rootGeekDevOps mysql-5.7.21-el7-x86_64]# cd ..[rootGeekDevOps mysql]# rmdir mysql-5.7.21-el7-x86_64/[rootGeekDevOps mysql]# mkdir data[rootGeekDevOps mysql]# chown -R mysql.mysql ../mysql[rootGeekDevOps mysql]# cd bin[rootGeekDevOps bin]# ./mysqld --usermysql --basedir/usr/local/mysql --datadir/usr/local/mysql/data --initialize[rootGeekDevOps bin]# tail -100f ../data/error.log2018-03-14T06:32:34.966407Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-03-14T06:32:36.208273Z 0 [Warning] InnoDB: New log files created, LSN457902018-03-14T06:32:36.367294Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2018-03-14T06:32:36.522777Z 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: 7c405e3f-2751-11e8-8be8-000c29fb0102.2018-03-14T06:32:36.525594Z 0 [Warning] Gtid table is not ready to be used. Table mysql.gtid_executed cannot be opened.2018-03-14T06:32:36.526540Z 1 [Note] A temporary password is generated for rootlocalhost: 7Eu;dsRqkY.3[rootGeekDevOps bin]# cp ../support-files/mysql.server /etc/init.d/mysqld三、配置过程[rootGeekDevOps ~]# vi /etc/my.cnf[mysqld]port 3306basedir /usr/local/mysqldatadir/usr/local/mysql/datasocket/tmp/mysql.sockpid-file/usr/local/mysql/data/mysql.pidlog-error/usr/local/mysql/data/error.logcharacter_set_serverutf8usermysqlmax_connections1500symbolic-links0!includedir /etc/my.cnf.d四、启动服务并登陆[rootGeekDevOps ~]# service mysqld startStarting MySQL. SUCCESS![rootGeekDevOps mysql]# ./bin/mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.21Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type help; or \h for help. Type \c to clear the current input statement.mysql在此过程中要求输入密码在第三步中我们可以看到安装完成后的密码7Eu;dsRqkY.3输入即可登陆成功。五、修改密码mysql set passwordpassword(GeekDevOps);Query OK, 0 rows affected, 1 warning (0.00 sec)mysql quitBye下次登录即可使用新密码进行登录。安装过程至此结束其他配置与我之前写的glibc版的别无二致此处不再赘述其他配置请在my.cnf按照自己的需求进行配置。六、安装过程中出现的问题在安装完成之后查看日志我们看到TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details)。这是一个常见问题在配置文件/etc/my.cnf的mysqld块添加explicit_defaults_for_timestamp1重启数据库服务。在完成上一步操作的过程中查看日志发现提示--secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled。意思是与导出、导入有关的操作都是被禁用的我们需要导出、导入的话就需要设置在配置文件/etc/my.cnf中mysqld下加入:secure_file_priv/test(目录可以按需求更改)这一项也可以在安装初始化的时候加入--secure-file-priv/test。七、总结mysql-5.7.21-el7-x86_64.tar.gz该版本的MySQL安装教程在网上并不常见我是通过tar.gz包内的文档(/usr/local/mysql/docs/INFO_BIN)受到启发才进行安装的从文档中我们可以看到编译的详细信息。 Information about the build process: Build was run at 2017-12-28 05:42:32 on host vale08Build was done on Linux-4.1.12-61.1.27.el7uek.x86_64 using x86_64Build was done using cmake 2.8.12 Compiler flags used (from the sql/ subdirectory): # compile C with /bin/cc# compile CXX with /bin/cC_FLAGS -fPIC -Wall -Wextra -Wformat-security -Wvla -Wwrite-strings -Wdeclaration-after-statement -O3 -g -fabi-version2 -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF -I/export/home/pb2/build/sb_0-26514852-1514435436.48/release/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/extra/rapidjson/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/release/libbinlogevents/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/libbinlogevents/export -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/sql/conn_handler -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/libbinlogevents/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/sql -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/sql/auth -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/regex -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/zlib -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/extra/yassl/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/extra/yassl/taocrypt/include -I/export/home/pb2/build/sb_0-26514852-1514435436.48/release/sql -I/export/home/pb2/build/sb_0-26514852-1514435436.48/mysql-5.7.21/extra/lz4 -DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADEDC_DEFINES -DHAVE_CONFIG_H -DHAVE_LIBEVENT1 -DHAVE_REPLICATION -DMYSQL_SERVER -D_FILE_OFFSET_BITS64 -D_GNU_SOURCE