mysql安装流程

作者: 华龙007 | 来源:发表于2018-04-16 16:16 被阅读0次
[root@n5 ~]# rpm -q mariadb-server mariadb    #如果之前安装过mariadb,需要卸载

[root@n5 ~]# ls    #把安装包上传到root目录下
anaconda-ks.cfg  mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

[root@n5 ~]# useradd -r mysql    #创建一个系统用户mysql

[root@n5 ~]# id mysql
uid=997(mysql) gid=995(mysql) groups=995(mysql)

[root@n5 ~]# tar xf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local    #展开安装包

[root@n5 ~]# cd /usr/local/
[root@n5 local]# ln -sn mysql-5.7.18-linux-glibc2.5-x86_64/ mysql    #制作链接文件
lrwxrwxrwx  1 root root  35 Apr 12 23:20 mysql -> mysql-5.7.18-linux-glibc2.5-x86_64/
[root@n5 local]# cd mysql
[root@n5 mysql]# chown -R root.mysql ./\*    #修改mysql所有文件属组为mysql
[root@n5 mysql]# ll
total 36
drwxr-xr-x  2 root mysql  4096 Apr 12 23:16 bin
-rw-r--r--  1 root mysql 17987 Mar 18  2017 COPYING
drwxr-xr-x  2 root mysql    55 Apr 12 23:16 docs
drwxr-xr-x  3 root mysql  4096 Apr 12 23:16 include
drwxr-xr-x  5 root mysql   229 Apr 12 23:16 lib
drwxr-xr-x  4 root mysql    30 Apr 12 23:16 man
-rw-r--r--  1 root mysql  2478 Mar 18  2017 README
drwxr-xr-x 28 root mysql  4096 Apr 12 23:16 share
drwxr-xr-x  2 root mysql    90 Apr 12 23:16 support-files
[root@n5 mysql]# mkdir -pv /data/mysql    #创建mysql数据目录
mkdir: created directory ‘/data’
mkdir: created directory ‘/data/mysql’
[root@n5 mysql]# chown -R mysql.mysql /data/mysql/    #mysql进程要进行写操作,修改权限
[root@n5 mysql]# ll /data
total 0
drwxr-xr-x 2 mysql mysql 6 Apr 12 23:28 mysql
[root@n5 mysql]# vim /etc/profile.d/mysql.sh    #编写修改环境变量脚本
export PATH=/usr/local/mysql/bin:$PATH
[root@n5 mysql]# . /etc/profile.d/mysql.sh    #读取环境变量

[root@n5 mysql]# mkdir etc
[root@n5 mysql]# mkdir logs
[root@n5 mysql]# chown -R mysql.mysql logs/    #更改日志目录权限
[root@n5 mysql]# mysqld --initialize-insecure --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql
2018-04-13T05:28:25.149583Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-04-13T05:28:25.948412Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-04-13T05:28:26.058553Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-04-13T05:28:26.121981Z 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: 7da0526b-3edb-11e8-a71c-000c2977a305.
2018-04-13T05:28:26.124459Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-04-13T05:28:26.127938Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@n5 mysql]# cp /etc/my.cnf etc/
[root@n5 mysql]# vim etc/my.cnf    #修改mysql配置文件
[mysqld]
datadir=/data/mysql
socket=/tmp/mysql.sock
symbolic-links=0
[mysqld_safe]
log-error=/usr/local/mysql/logs/error.log
pid-file=/var/run/mysql/mysql.pid
!includedir /usr/local/mysql/etc/my.cnf.d

[root@n5 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@n5 mysql]# ll /etc/init.d/mysqld    #确保有执行权限
-rwxr-xr-x 1 root root 10576 Apr 13 01:39 /etc/init.d/mysqld
[root@n5 mysql]# chkconfig --add mysqld
[root@n5 mysql]# mkdir etc/my.cnf.d
[root@n5 mysql]# touch logs/error.log    #新建错误日志文件
[root@n5 mysql]# chown -R mysql.mysql logs/error.log    #修改错误日志文件属主属组
[root@n5 mysql]# service mysql start    #开启mysql服务
Redirecting to /bin/systemctl start mysql.service
[root@n5 mysql]# mysql    #运行mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL 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.
mysql> 

相关文章

  • Mac MySql 安装

    Mac 安装MySql的流程

  • 2018-10-16 Magento 从零开始安装 centos

    整个安装流程使用 yum 安装 , 不需手动编译。 大体流程如下: Centos 安装 Apache mysql ...

  • 解压版mysql+免破解版Navicat,好用!

    解压版mysql安装流程 获取mysql压缩包获取地址: 获取压缩包后可安装压缩包内的安装说明执行安装流程(整体配...

  • mysql安装流程

  • MySQL安装流程

    纯属一篇MySQL安装笔记,没太大技术含量记录一下,在安装过程中进行的环境路径的设置 下载安装 官网地址:MySQ...

  • MySQL安装流程

    系统:Centos 64位 第一步:下载tar.gz 1、进入官方下载首页:https://www.mysql.c...

  • mysql学习笔记

    1、mysql安装流程 参照这个教程进行安装没有问题的 http://jingyan.baidu.com/arti...

  • zabbix的安装配置

    zabbix_server的安装流程 1. 创建 zabbix database mysql> CREATE DA...

  • 百度云配置服务器(一)

    基本流程 使用云服务器搭建LNMP平台的操作步骤如下: 准备编译环境。 安装Nginx。 安装MySQL。 安装P...

  • 日记 2018-01-02

    一、Mysql的安装流程(mysql5.5版本) 注意:安装之前,请关闭杀毒软件和防火墙。 然后,点击下一步。 选...

网友评论

    本文标题:mysql安装流程

    本文链接:https://www.haomeiwen.com/subject/hieekftx.html