Instalación del código fuente MySQL 5.6 centos 7

Instalación del código fuente MySQL 5.6 centos 7

#! / bin / bash 
##### 源码 通用 版 código fuente genérico linux 

sed -i ' s / SELINUX =. * / SELINUX = deshabilitado / g ' / etc / selinux / config 
setenforce 0 
getenforce 

#hostnamectl set - hostname node $ (ip addr | grep global | grep $ (ruta | grep predeterminado | awk  ' {print $ NF} ' ) | head -n1 | awk  ' {print $ 2} ' | cut -d ' / ' -f1 | cut -d '. ' - F4) 

## montado dependencia 
ñam  la instalación -Y GCC  GCC -C ++ ncurses- devel autoconf CMake libaio bisonte 

# añadir un usuario con el nombre mysql. # -g: especifique el grupo de usuarios (grupo) al que pertenece el nuevo usuario # -M: no cree el directorio raíz # -s: defina el shell que utiliza, / sbin / nologin significa que el usuario no puede iniciar sesión en el sistema. 
groupadd mysql 
useradd mysql -g mysql -M -s / sbin / nologin 

# mysql5.6 instalación del código fuente 
# 1 Compile e instale
 wget http: // cdn.mysql.com/archives/mysql-5.6/mysql-5.6.39.tar. -O-5.6.39.tar.gz MySQL GZ 

el alquitrán zxvf MySQL- 5.6 . 39 . el alquitrán .gz && CD MySQL- 5,6. 39 && cmake ./ -DCMAKE_INSTALL_PREFIX = / usr / local / mysql -DMYSQL_DATADIR = / usr / local / mysql / datos -DSYSCONFDIR = / usr / local / mysql / etc -DWITH_MYISAM_STORAGE_ENGINE = 1 -DWITH_INNOBASE_STORAGE_ENGINE = 1 -DWITH_MEMORY_STORAGE_ENGINE = 1 -DWITH_READLINE = 1 -DMYSQL_UNIX_ADDR = / tmp / mysqld.sock -DMYSQL_TCP_PORT = 3306 -DENABLED_LOCAL_INFILE = 1 -DWITH_PARTITION_STORAGE_ENGINE = 1 -DEXTRA_CHARSETS = all = UTF-8 -DDEFAULT_CHARSET -DDEFAULT_COLLATION = utf8_general_ci &&   make && make  instalar 


#参数说明
# -DCMAKE_INSTALL_PREFIX = / usr / local /  mysql \ # 安装 路径
# -DMYSQL_DATADIR = / usr / local / MySQL / Data \ # los archivos de datos 
# -DSYSCONFDIR = / etc \ Ruta de la my.cnf # 
# -DWITH_MYISAM_STORAGE_ENGINE = . 1                    \ # soporte del motor MyIASM 
# -DWITH_INNOBASE_STORAGE_ENGINE = . 1                  \ # de soporte motor InnoDB 
# -DWITH_MEMORY_STORAGE_ENGINE = 1                    \ #Support Memory Engine 
# -DWITH_READLINE = 1                                 \ # Función de tecla de atajo (no la he usado) 
# -DMYSQL_UNIX_ADDR = / tmp / mysqld.sock \ #Conecte a la ruta del zócalo de la base de datos 
# -DMYSQL_TCP_PORT = 3306                            \ # Puerto 
# -DENABLED_LOCAL_INFILE = 1                          \ # Permitir que los datos locales de importación de 
# -DWITH_PARTITION_STORAGE_ENGINE = 1                 \ # soporte para la instalación de la base de datos de partición 
# -DEXTRA_CHARSETS = All \ # instalar todos los caracteres 
# -DDEFAULT_CHARSET = utf8 \ # default 
# -DDEFAULT_COLLATION = utf8_general_ci 


\ cp ./support-files/mysql.server /etc/init.d/ mysqld
 chmod a + x /etc/init.d/ mysqld 

echo  ' export PATH = / usr / local / mysql / bin: $ PATH '>> / etc / profile 
source / etc / profile 

chown -R mysql: mysql / usr / local / mysql 

# 初始化 数据库
 / usr / local / mysql / scripts / mysql_install_db --basedir = / usr / local / mysql --datadir = / usr / local / mysql / data --user = mysql 


[$ ( grep -c ' sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES ' /etc/my.cnf) -eq 0 ] && sed -i ' / \ [mysqld \] / a sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES ' / etc / my.cnf 

sed -i ' s # ^ datadir =. * # datadir = / usr / local / mysql / data # g '  / etc / my.cnf
 sed -i ' s # ^ socket =. * # socket = / usr / local / mysql / mysql.sock # g '   / etc / my.cnf
 sed -i ' s # ^ log-error = . * # datadir = / usr / local / mysql / log / mysql.log # g '   / etc / my.cnf
 sed -i ' s # ^ pid-file =. * # pid-file = / usr / local / mysql /mysql.pid#g '   / etc / my.cnf
 sed -i ' s # ^ socket =. * # socket = / tmp / mysqld.sock # g '   / etc / my.cnf 

# sed -i ' s # ^ socket =. * # socket = / usr / local / mysql / mysql.sock # g '   / etc / my.cnf 
# ln-s /usr/local/mysql/mysql.sock / tmp / mysqld.sock
 egrep -v ' ^ # | ^ $ ' / etc / my.cnf


 /etc/init.d/ mysqld restart 

#systemctl start mysqld 
systemctl enable mysqld

 

Supongo que te gusta

Origin www.cnblogs.com/blog-lhong/p/12692824.html
Recomendado
Clasificación