• mysql 更改数据目录


    [root@dwh1 ~]# su - mysql
    -bash-4.1$ ps -ef | grep mysql
    root      6643  6620  0 00:25 pts/6    00:00:00 su - mysql
    mysql     6644  6643  0 00:25 pts/6    00:00:00 -bash
    mysql     6665  6644  4 00:25 pts/6    00:00:00 ps -ef
    mysql     6666  6644  0 00:25 pts/6    00:00:00 grep mysql
    mysql    44296     1  0 Apr15 ?        00:00:00 /bin/sh /usr/local/mysql5.6/bin/mysqld_safe --datadir=/usr/local/mysql5.6/data --pid-file=/usr/local/mysql5.6/data/dwh1.pid
    mysql    44409 44296  0 Apr15 ?        00:00:11 /usr/local/mysql5.6/bin/mysqld --basedir=/usr/local/mysql5.6 --datadir=/usr/local/mysql5.6/data --plugin-dir=/usr/local/mysql5.6/lib/plugin --log-error=/usr/local/mysql5.6/data/dwh1.err --pid-file=/usr/local/mysql5.6/data/dwh1.pid
     
    [root@dwh1 ~]# mkdir /mysql
    [root@dwh1 ~]# chown -R mysql:mysql /mysql
    [root@dwh1 ~]# su - mysql
    -bash-4.1$ cd /usr/local/mysql5.6/
    -bash-4.1$ ls
    COPYING  INSTALL-BINARY  README  bin  data  docs  include  lib  man  my.cnf  mysql-test  scripts  share  sql-bench  support-files
    -bash-4.1$ mv data /mysql/
    
    
    /usr/local/mysql5.6/bin/mysqld_safe --datadir=/mysql/data 
    
    
    修改/etc/my.cnf
    
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
    datadir=/mysql/data
    
    [root@dwh1 data]# /etc/init.d/mysql start
    Starting MySQL                                             [确定]
    
    [root@dwh1 data]# ps -ef | grep mysqld
    root      8237     1  1 00:35 pts/0    00:00:00 /bin/sh /usr/local/mysql5.6/bin/mysqld_safe --datadir=/mysql/data --pid-file=/mysql/data/dwh1.pid
    mysql     8368  8237 61 00:35 pts/0    00:00:01 /usr/local/mysql5.6/bin/mysqld --basedir=/usr/local/mysql5.6 --datadir=/mysql/data --plugin-dir=/usr/local/mysql5.6/lib/plugin --user=mysql --log-error=/mysql/data/dwh1.err --pid-file=/mysql/data/dwh1.pid
    root      8393  6415  0 00:35 pts/0    00:00:00 grep mysqld

  • 相关阅读:
    谷粒商城心得(四)
    centos7设置rc.local开机执行命令
    密码学简介
    如何解决 kubernetes 重启后,启来不来的问题
    谷粒商城安装ES及入门(十六)
    谷粒商城读写分离(十五)
    谷粒商城创建mysql主从(十四)
    虚拟机LVM在线扩容
    Builder 模式初探
    Mysql 导入实战
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351779.html
Copyright © 2020-2023  润新知