• 二进制安装mysql


    1.创建安装目录:
    [root@db01 ~]# mkdir /application

    2.下载二进制安装包:
    wget https://downloads.mysql.com/archives/get/file/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz

    3.解压二进制包:
    [root@db01 ~]# tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz

    4.移动解压目录
    [root@db01 ~]# mv mysql-5.6.40-linux-glibc2.12-x86_64 /application/mysql-5.6.40

    5.做MySQL软连接
    [root@db01 scripts]# ln -s /application/mysql-5.6.40/ /application/mysql

    6.创建MySQL用户
    [root@db01 ~]# useradd mysql -s /sbin/nologin -M

    7.进入配置文件及启动脚本目录
    [root@db01 ~]# cd /application/mysql-5.6.40/support-files

    8.拷贝配置文件到/etc/my.cnf
    [root@db01 support-files]# cp my-default.cnf /etc/my.cnf

    9.拷贝启动脚本
    [root@db01 support-files]# cp mysql.server /etc/init.d/mysqld

    10.初始化MySQL
    [root@db01 scripts]# cd /application/mysql-5.6.40/scripts
    [root@db01 scripts]# ./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
    --user 指定mysql用户
    --basedir 指定mysql安装目录
    --datadir 指定mysql数据目录

    11.修改MySQL启动脚本及启动程序
    [root@db01 scripts]# sed -i 's#/usr/local#/application#g' /etc/init.d/mysql /application/mysql/bin/mysqld_safe

    12.启动MySQL
    [root@db01 scripts]# /etc/init.d/mysqld start

    13.添加环境变量
    [root@db01 scripts]# echo 'export PATH="/application/mysql/bin:$PATH"' > /etc/profile.d/mysql.sh

    14.加载环境变量
    [root@db01 scripts]# source /etc/profile

    15.添加systemd启动

    [root@db01 scripts]# vim /etc/systemd/system/mysqld.service
    [Unit]
    Description=MySQL Server
    Documentation=man:mysqld(8)
    Documentation=https://dev.mysql.com/doc/refman/en/using-systemd.html
    After=network.target
    After=syslog.target
    [Install]
    WantedBy=multi-user.target
    [Service]
    User=mysql
    Group=mysql
    ExecStart=/application/mysql/bin/mysqld --defaults-file=/etc/my.cnf
    LimitNOFILE = 5000


    MySQL查看报错:
    [root@db01 scripts]# tail -100 /application/mysql/data/db01.err


    连接MySQL:
    [root@db01 scripts]# mysql

    查看库:
    mysql> show databases;

  • 相关阅读:
    BZOJ3527: [Zjoi2014]力(FFT)
    NOIP 2018游记
    BZOJ2763: [JLOI2011]飞行路线(分层图 最短路)
    11.7NOIP模拟赛解题报告
    交互体验之产品的文案
    关于java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream解决办法
    [置顶] android 与JavaScript的互相调用
    linux系统的文件类型学习
    VS2012 开发SharePoint 2013 声明式workflow action(activity)之 HelloWorld
    js判断浏览器类型 js判断ie6不执行
  • 原文地址:https://www.cnblogs.com/fangdecheng/p/9997942.html
Copyright © 2020-2023  润新知