系统版本:系统是最小化安装
@查看系统版本 [root@localhost ~]# cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7" [root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) @查看内核版本 [root@localhost ~]# cat /proc/version Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015 [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
安装包:mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
下载地址:
官网:http://dev.mysql.com/downloads/mysql/
[BEGIN] 2017/8/24 16:49:51 Last login: Mon Aug 7 18:50:39 2017 from 10.2.202.39 -- [root@localhost ~]# groupadd @R_502_198@ [root@localhost ~]# useradd -g @R_502_198@ -d /home/@R_502_198@ @R_502_198@ [root@localhost ~]# mkdir /home/@R_502_198@/data [root@localhost ~]# mkdir /home/@R_502_198@/log [root@localhost ~]# cd /home/@R_502_198@ [root@localhost @R_502_198@]# vi /home/@R_502_198@/log/mariadb.log -bash: [root@localhost: command not found [root@localhost ~]# vi /home/@R_502_198@/log/mariadb.log :wq "/home/@R_502_198@/log/mariadb.log" [New] 0L,0C written [root@localhost ~]# cd /home/@R_502_198@/log/ [root@localhost log]# ll total 0 -rw-r--r--. 1 root root 0 Aug 7 19:02 mariadb.log [root@localhost log]# cd /home/@R_502_198@ [root@localhost @R_502_198@]# tar -xzvf @R_502_198@-5.7.19-linux-glibc2.12-x86_64.tar.gz [root@localhost @R_502_198@]# cd @R_502_198@-5.7.19-linux-glibc2.12-x86_64 [root@localhost @R_502_198@-5.7.19-linux-glibc2.12-x86_64]# mv * /home/@R_502_198@/ [root@localhost @R_502_198@-5.7.19-linux-glibc2.12-x86_64]# cd .. [root@localhost @R_502_198@]# rm -rf @R_502_198@-5.7.19-linux-glibc2.12-x86_64 [root@localhost @R_502_198@]# vi support-files/@R_502_198@.server @在这里增加上路径 basedir=/home/@R_502_198@ @在这里增加上路径 datadir=/home/@R_502_198@/data @按Esc退出编辑模式,输入:wq 保存退出 :wq [root@localhost @R_502_198@]# vi /etc/my.cnf @修改前 "/etc/my.cnf" 19L,570C[@R_502_198@d] datadir=/var/lib/@R_502_198@ socket=/var/lib/@R_502_198@/@R_502_198@.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run @R_502_198@d under a different user or group,# customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [@R_502_198@d_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # include all files from the config directory !includedir /etc/my.cnf.d datadir=/var/lib/mysq-- INSERT --l/home/@R_502_198@/datasql.sock/tmp/@R_502_198@.sock character_set_server=utf8 init_connect='SET NAMES utf8' [client] default-character-set=utf8/mariadb.log/home/@R_502_198@/log/mariadb.lid/home/@R_502_198@/log//mariadb.pid:wq "/etc/my.cnf" 22L,652C written @修改后: [@R_502_198@d] datadir=/home/@R_502_198@/data socket=/tmp/@R_502_198@.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run @R_502_198@d under a different user or group,# customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd character_set_server=utf8 init_connect='SET NAMES utf8' [client] default-character-set=utf8 [@R_502_198@d_safe] log-error=/home/@R_502_198@/log/mariadb.log pid-file=/home/@R_502_198@/log//mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d "/etc/my.cnf" 22L,652C written [root@localhost home]# cd /home/@R_502_198@/ [root@localhost @R_502_198@]# chown -R @R_502_198@:@R_502_198@ . @查询权限 [root@localhost @R_502_198@]# ll total 625676 drwxr-xr-x. 2 @R_502_198@ @R_502_198@ 4096 Aug 7 19:05 bin -rw-r--r--. 1 @R_502_198@ @R_502_198@ 17987 Jun 22 22:13 COPYING drwxr-xr-x. 2 @R_502_198@ @R_502_198@ 6 Aug 7 19:00 data drwxr-xr-x. 2 @R_502_198@ @R_502_198@ 52 Aug 7 19:05 docs drwxr-xr-x. 3 @R_502_198@ @R_502_198@ 4096 Aug 7 19:05 include drwxr-xr-x. 5 @R_502_198@ @R_502_198@ 4096 Aug 7 19:05 lib drwxr-xr-x. 2 @R_502_198@ @R_502_198@ 24 Aug 7 19:02 log drwxr-xr-x. 4 @R_502_198@ @R_502_198@ 28 Aug 7 19:05 man -rw-r--r--. 1 @R_502_198@ @R_502_198@ 640650826 Aug 7 19:04 @R_502_198@-5.7.19-linux-glibc2.12-x86_64.tar.gz -rw-r--r--. 1 @R_502_198@ @R_502_198@ 2478 Jun 22 22:13 README drwxr-xr-x. 28 @R_502_198@ @R_502_198@ 4096 Aug 7 19:05 share drwxr-xr-x. 2 @R_502_198@ @R_502_198@ 86 Aug 7 19:07 support-files @初始化实例 [root@localhost @R_502_198@]# ./bin/@R_502_198@d --user=@R_502_198@ --basedir=/home/@R_502_198@ --datadir=/home/@R_502_198@/data --initialize 2017-08-07T11:09:24.645721Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-08-07T11:09:27.252970Z 0 [Warning] InnoDB: New log files created,LSN=45790 2017-08-07T11:09:27.519535Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-08-07T11:09:27.831349Z 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: e0e5a75a-7b60-11e7-bde3-000c2987bdd8. 2017-08-07T11:09:27.912800Z 0 [Warning] Gtid table is not ready to be used. Table '@R_502_198@.gtid_executed' cannot be opened. 2017-08-07T11:09:27.914113Z 1 [Note] A temporary password is generated for root@localhost: +D<3syDc#s3< @启动数据库 [root@localhost @R_502_198@]# ./support-files/@R_502_198@.server start Starting @R_502_198@. SUCCESS! @启动成功 [root@localhost @R_502_198@]# ./support-files/@R_502_198@.server stop Shutting down @R_502_198@.. SUCCESS! @停止数据库 @设置随机启动 [root@localhost @R_502_198@]# cp /home/@R_502_198@/support-files/@R_502_198@.server /etc/init.d/@R_502_198@d [root@localhost @R_502_198@]# chmod 755 /etc/init.d/@R_502_198@d [root@localhost @R_502_198@]# chkconfig --level 345 @R_502_198@d on @启动数据库 [root@localhost @R_502_198@]# ./support-files/@R_502_198@.server start Starting @R_502_198@. SUCCESS! @更改初始密码 [root@localhost @R_502_198@]# ./bin/@R_502_198@admin -uroot -p'.QQ7emrasrc0' password '123456' @R_502_198@admin: [Warning] Using a password on the command line interface can be insecure. Warning: Since password will be sent to server in plain text,use ssl connection to ensure password safety. @建软链接 [root@localhost @R_502_198@]# ln -s /home/@R_502_198@/bin/@R_502_198@ /usr/bin/@R_502_198@ [root@localhost @R_502_198@]# @R_502_198@ -uroot -p123456 @R_502_198@: [Warning] Using a password on the command line interface can be insecure. Welcome to the @R_502_198@ monitor. Commands end with ; or \g. Your @R_502_198@ connection id is 4 Server version: 5.7.19 @R_502_198@ Community Server (GPL) Copyright (c) 2000,2017,Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. @打开与外部链接 @R_502_198@> grant all on *.* to 'root'@'%' identified by '123456'; Query OK,0 rows affected,1 warning (0.00 sec) @R_502_198@> exit Bye [root@localhost @R_502_198@]#
学习安装来源参考于:http://www.jb51.cc/article/p-bfanaylv-gk.html
感谢:QQ:929679459 的远程协助帮忙处理,十分感谢