zoukankan      html  css  js  c++  java
  • MySQL/MariaDB随笔二

    mariaDB的二进制安装:系统版本和MariaDB版本

    [root@192 ~]# cat /etc/redhat-release 
    CentOS Linux release 7.5.1804 (Core)
    [root@192 ~]# ll |grep mar
    -rw-r--r--. 1 root root 758522993 Apr 23 15:34 mariadb-10.3.22-linux-x86_64.tar.gz

    1检查环境:

    iptables

    selinux

    mysql-server

    mariadb-server

    2.下载二进制包

    3.安装过程

    #1.创建账号
    #   -r表示系统账号 -d 指定家目录 如果-r家目录不会自动创建需要加-m  存放的是用户信息
    
    [root@192 ~]# useradd -r -d /data/mysql -s /sbin/nologin mysql
    [root@192 ~]# getent passwd mysql
    mysql:x:989:983::/data/mysql:/sbin/nologin
    [root@192 ~]# id mysql
    uid=989(mysql) gid=983(mysql) groups=983(mysql)
    #2.创建安装路径,可以从官网的安装包处查看
    [root@192 ~]# tar -zxvpf mariadb-10.3.22-linux-x86_64.tar.gz  -C  /usr/local/
    #3.创建软连接
    [root@192 ~]# cd /usr/local/
    [root@192 local]# ln -s mariadb-10.3.22-linux-x86_64/  mysql
    [root@192 local]# chown -R root mysql/
    #4.修改主进程配置文件
    [root@192 local]# ls /usr/local/mysql/bin/
    #5.配置PATH环境
    [root@192 local]# echo PATH=/usr/local/mysql/bin:$PATH > /etc/profile.d/mysql.sh
    #6.生效PATH配置
    [root@192 local]# . /etc/profile.d/mysql.sh
    #7.创建数据库的存放目录 此时/usr/local/mysql/是二进制程序的目录 /data/mysql/是数据库的存放目录/
    [root@192 data]# getent passwd mysql
    mysql:x:989:983::/data/mysql:/sbin/nologin
    [root@192 local]# mkdir /data/mysql/
    [root@192 data]# chown mysql.mysql /data/mysql/
    [root@192 data]# chmod 770 /data/mysql
    #8.运行脚本
    #进到目录
    [root@192 data]# cd /usr/local/mysql/
    #指定生成的数据库的目录,指定用户,执行时必须在此目录
    [root@192 mysql]# scripts/mysql_install_db  --datadir=/data/mysql --user=mysql
    #9.修改配置文件
    [root@192 mysql]# cd support-files/
    [root@192 mysql]# vim /etc/my.cnf
    [mysqld]
    #数据创建的路径
    datadir=/data/mysql
    #socket路径
    socket=/var/lib/mysql/mysql.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 mysqld under a different user or group,
    # customize your systemd unit file for mariadb according to the
    # instructions in http://fedoraproject.org/wiki/Systemd
    
    [mysqld_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
    
    #10.启动程序的进程脚本
    [root@192 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
    #加成服务
    [root@192 mysql]# chkconfig --list
    [root@192 mysql]# chkconfig --add mysqld
    [root@192 mysql]# setfacl  -m -R u:mysql:rwx /usr/local/mysql/
  • 相关阅读:
    Html-浅谈如何正确给table加边框
    如何在移动设备上调试html5开发的网页
    swiper嵌套小demo(移动端触摸滑动插件)
    移动端如何用swiper实现导航栏效果
    background-color:transparent
    点击按钮 发送短信验证码后60秒倒计时
    placeholder的样式设置
    linux 定时任务crontab
    laravel学习一
    centos 7安装jdk
  • 原文地址:https://www.cnblogs.com/hekuangquanshuiweiteng/p/12766627.html
Copyright © 2011-2022 走看看