标签:设置mysql 检查 user cert org pcre 注册服务 直接下载 none
[root@base ~]# yum repolist all | grep mysql mysql-cluster-7.5-community MySQL Cluster 7.5 Community disabled mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled mysql-cluster-7.6-community MySQL Cluster 7.6 Community disabled mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled mysql-cluster-8.0-community MySQL Cluster 8.0 Community disabled mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - disabled mysql-connectors-community MySQL Connectors Community enabled: 102 mysql-connectors-community-source MySQL Connectors Community - S disabled mysql-tools-community MySQL Tools Community enabled: 81 mysql-tools-community-source MySQL Tools Community - Source disabled mysql-tools-preview MySQL Tools Preview disabled mysql-tools-preview-source MySQL Tools Preview - Source disabled mysql55-community MySQL 5.5 Community Server disabled mysql55-community-source MySQL 5.5 Community Server - S disabled mysql56-community MySQL 5.6 Community Server disabled mysql56-community-source MySQL 5.6 Community Server - S disabled mysql57-community MySQL 5.7 Community Server disabled mysql57-community-source MySQL 5.7 Community Server - S disabled mysql80-community MySQL 8.0 Community Server enabled: 113 mysql80-community-source MySQL 8.0 Community Server - S disabled
#/usr/bin # #1.检查是否安装了mysql,如果已经安装了,则要把原先的版本卸载掉 #rpm -qa|grep mysql for i in `rpm -qa | grep "mysql"`; do rpm -e --allmatches $i --nodeps; done #2.安装必要的软件包 yum install -y make gcc-c++ cmake bison-devel ncurses-devel yum install -y gcc gcc-c++ kernel-devel yum install -y readline-devel pcre-devel openssl-devel openssl zlib zlib-devel pcre-devel #3.下载mysql,如果已经下载文件,请修改这部分 cd /home #只是习惯把文件下载到/home目录下 wget --no-check-certificate http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.27.tar.gz #wget --no-check-certificate https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/ #tar xf boost_1_59_0.tar.gz -C /usr/local/boost tar -zxvf mysql-boost-5.7.27.tar.gz cd mysql-5.7.27 #4.使用cmake编译 mysql_home=/u01/app/mysql #自定义地址 if [ ! -d "$mysql_home" ]; then mkdir -p "$mysql_home" fi cmake -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_BOOST=boost make && make install #2.新建mysql的用户 user=mysql group=dba #create group if not exists egrep "^$group" /etc/group >& /dev/null if [ $? -ne 0 ] then groupadd $group fi #create user if not exists egrep "^$user" /etc/passwd >& /dev/null if [ $? -ne 0 ] then useradd -g $group $user fi if [ ! -d "$mysql_home/data" ]; then mkdir -p "$mysql_home/data" fi if [ ! -d "$mysql_home/run" ]; then mkdir -p "$mysql_home/run" fi if [ ! -d "$mysql_home/log" ]; then mkdir -p "$mysql_home/log" fi #这里有可能报错,会导致数据库服务开不起来,后来把--datadir=$mysql_home/data后重跑一遍就可以开启服务了 cd $mysql_home bin/mysqld --user=mysql --basedir=$mysql_home --datadir=$mysql_home/data --initialize chown -R mysql:dba $mysql_home #注册服务 cd $mysql_home/support-files cp mysql.server /etc/init.d/mysqld #拷贝配置文件 #cp /mnt/hgfs/virtual_share_file/my_adjust.cnf $mysql_home/my.cnf #开机启动 chkconfig mysqld on
标签:设置mysql 检查 user cert org pcre 注册服务 直接下载 none
原文地址:https://www.cnblogs.com/hwj2019/p/11575984.html