产品服务AMH 免费服务器主机面板SSL证书 免费SSL证书申请 担保单 免费安全、零费率交易平台编程助手免费智能写代码、翻译AMYSQL 免费MySQL管理工具

AMH 社区首页

 AMH社区 - 开放自由有价值的社区

[求助帖] mysql5.7数据库 安装失败

血性方刚
铝牌会员
265.29 价值分

血性方刚 发表于 2016-04-22 23:46:07


2016-04-22 23:46:07 1

血性方刚
铝牌会员
265.29 价值分

mysql5.7数据库 安装失败
  支持 (0分)  反对 (0分)
回复  2016-04-23 10:07:01 2

GeekCnh
银牌会员
1016.93 价值分

mysql没有下载完整,下载超时导致的
  支持 (0分)  反对 (0分)
回复  2016-04-23 13:18:35 3

siaoynli
铝牌会员
319.29 价值分

boost下载失败~~~
  支持 (0分)  反对 (0分)
回复  2016-04-26 16:49:33 4

siaoynli
铝牌会员
319.29 价值分

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin;

ModuleName='mysql-5.7';
ModuleSort='server';
ModuleType='databases';
ModuleMainVersion='5.7';
ModuleVersion='5.7.12';
ModuleDescription='MySQL5.7版本,安装需要1200MB以上内存,安装时间大约25至60分钟。MySQL是一个关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司。MySQL有社区版和商业版,社区版由于其体积小、速度快、总体拥有成本低,开放源码等特点,目前广泛应用于PHP等WEB应用环境。';
ModuleInstallPath=/usr/local/${ModuleName};
ModuleDate='2016-04-20';
ModuleWebSite='http://amh.sh';
ModuleIco='logo.gif';
ModuleScriptBy='amysql';

ModuleNeedParamFunctions='install';
ModuleProcessTag="${ModuleInstallPath}/bin/mysqld_safe";
ModuleProcessFunctions='cmd:stop,txt:停止|cmd:restart,txt:重启';
ModuleNotProcessFunctions='cmd:start,txt:启动';
ModuleInstallFunctions='cmd:check,txt:效验配置|cmd:uninstall,txt:卸载,class:red';
ModuleNotInstallFunctions='cmd:install,txt:安装|cmd:delete,txt:删除,class:red';
ModuleVid='1';


#init
function amh_module_init()
{
if grep ${ModuleName} ${amh_www}/etc/amh-base.conf 2>/dev/null; then
ModuleInstallFunctions='cmd:check,txt:效验配置';
ModuleProcessFunctions='cmd:restart,txt:重启';
fi;
}

#install
function amh_module_install()
{
if amh_module_status ; then
return;
else
MysqlPass=$1;
amh_yum_install cmake ncurses-devel bison;
amh_apt_install cmake libncurses5-dev bison;
RamTotal=`free -m | grep 'Mem' | awk '{print $2}'`;
RamSwap=`free -m | grep 'Swap' | awk '{print $2}'`;
RamSum=$[$RamTotal+$RamSwap];
if [ "$RamSum" -lt '1200' ]; then
echo -e "[Error] Not enough memory install ${ModuleName}. \n(need memory: ${RamTotal}MB*RAM + ${RamSwap}MB*Swap > 1200MB)";
exit;
fi;

# if [ ! -d /usr/local/boost_1_60_0 ]; then
# cd /usr/local/;
# amh_wget boost_1_60_0.tar.gz 28f58b9a33469388302110562bdf6188;
# tar -zxf boost_1_60_0.tar.gz;
# rm -f boost_1_60_0.tar.gz;
# fi;


if [ ! -d /usr/local/include/boost ]; then
cd /usr/local/;
wget http://amh5.2014520.cn/files/boost_1_59_0.tar.gz;
tar -zxvf boost_1_59_0.tar.gz;
cd /usr/local/boost_1_59_0;
./bootstrap.sh;
./b2 install;
rm -rf /usr/local/boost_1_59_0;
rm -f boost_1_59_0.tar.gz;
fi;


cd /tmp/;
amh_wget mysql-${ModuleVersion}.tar.gz af17ba16f1b21538c9de092651529f7c;
tar -zxvf mysql-${ModuleVersion}.tar.gz;
cd mysql-${ModuleVersion};

groupadd mysql;
useradd -s /sbin/nologin -g mysql mysql;
cmake -DCMAKE_INSTALL_PREFIX=${ModuleInstallPath} -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1;
#cmake -DCMAKE_INSTALL_PREFIX=${ModuleInstallPath} -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost_1_60_0/boost/;
#http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide
amh_make_install;
chmod +w ${ModuleInstallPath};
chown -R mysql:mysql ${ModuleInstallPath};

rm -f /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf;
[ -d ${ModuleInstallPath} ] && cp ${amh_home}/modules/${ModuleName}/my.cnf ${ModuleInstallPath};
${ModuleInstallPath}/bin/mysqld --initialize-insecure --user=mysql --basedir=${ModuleInstallPath} --datadir=/home/usrdata/${ModuleName};
chmod +w /home/usrdata/${ModuleName};
chown -R mysql:mysql /home/usrdata/${ModuleName};
${ModuleInstallPath}/support-files/mysql.server start;

if [ "$MysqlPass" != '' ]; then
${ModuleInstallPath}/bin/mysqladmin -S /tmp/${ModuleName}.sock -u root password $MysqlPass;
sql="USE mysql;DELETE FROM user WHERE User!='root' OR (User = 'root' AND Host != 'localhost');FLUSH PRIVILEGES;";
${ModuleInstallPath}/bin/mysql -uroot -p${MysqlPass} -S /tmp/${ModuleName}.sock -B -N -e "${sql}";
else
sql="USE mysql;DELETE FROM user WHERE User!='root' OR (User = 'root' AND Host != 'localhost');FLUSH PRIVILEGES;";
${ModuleInstallPath}/bin/mysql -uroot -S /tmp/${ModuleName}.sock -B -N -e "${sql}";
fi;

cd /tmp/;
rm -rf /home/usrdata/mysql-${ModuleVersion}/test;
rm -rf /tmp/mysql-${ModuleVersion} /tmp/mysql-${ModuleVersion}.tar.gz;
amh_module_status;
fi;
}

#boot
function amh_module_boot()
{
amh_module_start;
}

#start
function amh_module_start()
{
if amh_module_status ; then
if ! ${ModuleInstallPath}/support-files/mysql.server start; then
cat /home/usrdata/${ModuleName}/*.err;
echo "[Error] $ModuleName start failed.";
return 1;
fi;
else
return 1;
fi;
}

#stop
function amh_module_stop()
{
if amh_module_status ; then
if ! ${ModuleInstallPath}/support-files/mysql.server stop; then
cat /home/usrdata/${ModuleName}/*.err;
echo "[Error] $ModuleName stop failed.";
return 1;
fi;
else
return 1;
fi;
}

#restart
function amh_module_restart()
{
if amh_module_status ; then
if ! ${ModuleInstallPath}/support-files/mysql.server restart; then
cat /home/usrdata/${ModuleName}/*.err;
echo "[Error] $ModuleName restart failed.";
return 1;
fi;
else
return 1;
fi;
}

#check
function amh_module_check()
{
if amh_module_status ; then
${ModuleInstallPath}/bin/mysqld --defaults-file=${ModuleInstallPath}/my.cnf --help --verbose;
status=$?;
echo '--------------------------------------------------------'
cat ${ModuleInstallPath}/my.cnf;
[ "$status" == '0' ] && echo "[OK] ${ModuleName} is ok.";
return $status;
else
return 1;
fi;
}

#uninstall
function amh_module_uninstall()
{
if amh_module_status ; then
if grep ${ModuleName} ${amh_www}/etc/amh-base.conf >/dev/null; then
echo "[Notice] ${ModuleName} Uninstall not allowed.";
return 1;
fi;

${ModuleInstallPath}/support-files/mysql.server stop && \
rm -rf ${ModuleInstallPath} && \
rm -rf /usr/local/include/boost && \
echo "[OK] ${ModuleName} Uninstall successful." && return 0;
return 1;
else
return;
fi;
}

#status
function amh_module_status()
{
if [ -f "${ModuleInstallPath}/bin/mysql" ]; then
echo "[OK] ${ModuleName} is already installed.";
return 0;
else
echo "[Notice] ${ModuleName} is not installed.";
return 1;
fi;
}


修改代码,绿色是原版代码注释,红色是插入的代码,测试安装通过~~~~




  支持 (0分)  反对 (0分)
回复  2016-04-27 21:58:41 5

siaoynli
铝牌会员
319.29 价值分

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin;

ModuleName='mysql-5.7';
ModuleSort='server';
ModuleType='databases';
ModuleMainVersion='5.7';
ModuleVersion='5.7.12';
ModuleDescription='MySQL5.7版本,安装需要1200MB以上内存,安装时间大约25至60分钟。MySQL是一个关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司。MySQL有社区版和商业版,社区版由于其体积小、速度快、总体拥有成本低,开放源码等特点,目前广泛应用于PHP等WEB应用环境。';
ModuleInstallPath=/usr/local/${ModuleName};
ModuleDate='2016-04-20';
ModuleWebSite='http://amh.sh';
ModuleIco='logo.gif';
ModuleScriptBy='amysql';

ModuleNeedParamFunctions='install';
ModuleProcessTag="${ModuleInstallPath}/bin/mysqld_safe";
ModuleProcessFunctions='cmd:stop,txt:停止|cmd:restart,txt:重启';
ModuleNotProcessFunctions='cmd:start,txt:启动';
ModuleInstallFunctions='cmd:check,txt:效验配置|cmd:uninstall,txt:卸载,class:red';
ModuleNotInstallFunctions='cmd:install,txt:安装|cmd:delete,txt:删除,class:red';
ModuleVid='1';


#init
function amh_module_init()
{
if grep ${ModuleName} ${amh_www}/etc/amh-base.conf 2>/dev/null; then
ModuleInstallFunctions='cmd:check,txt:效验配置';
ModuleProcessFunctions='cmd:restart,txt:重启';
fi;
}

#install
function amh_module_install()
{
if amh_module_status ; then
return;
else
MysqlPass=$1;
amh_yum_install cmake ncurses-devel bison;
amh_apt_install cmake libncurses5-dev bison;
RamTotal=`free -m | grep 'Mem' | awk '{print $2}'`;
RamSwap=`free -m | grep 'Swap' | awk '{print $2}'`;
RamSum=$[$RamTotal+$RamSwap];
if [ "$RamSum" -lt '1200' ]; then
echo -e "[Error] Not enough memory install ${ModuleName}. \n(need memory: ${RamTotal}MB*RAM + ${RamSwap}MB*Swap > 1200MB)";
exit;
fi;

# if [ ! -d /usr/local/boost_1_60_0 ]; then
# cd /usr/local/;
# amh_wget boost_1_60_0.tar.gz 28f58b9a33469388302110562bdf6188;
# tar -zxf boost_1_60_0.tar.gz;
# rm -f boost_1_60_0.tar.gz;
# fi;

if [ ! -d /usr/local/include/boost ]; then
cd /tmp/;
wget http://amh5.2014520.cn/files/boost_1_59_0.tar.gz;
tar -zxvf boost_1_59_0.tar.gz;
cd /tmp/boost_1_59_0;
./bootstrap.sh;
./b2 install;
rm -rf /tmp/boost_1_59_0;
rm -f /tmp/boost_1_59_0.tar.gz;
fi;


cd /tmp/;
amh_wget mysql-${ModuleVersion}.tar.gz af17ba16f1b21538c9de092651529f7c;
tar -zxvf mysql-${ModuleVersion}.tar.gz;
cd mysql-${ModuleVersion};

groupadd mysql;
useradd -s /sbin/nologin -g mysql mysql;
cmake -DCMAKE_INSTALL_PREFIX=${ModuleInstallPath} -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1;
#cmake -DCMAKE_INSTALL_PREFIX=${ModuleInstallPath} -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/usr/local/boost_1_60_0/boost/;
#http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide
amh_make_install;
chmod +w ${ModuleInstallPath};
chown -R mysql:mysql ${ModuleInstallPath};

rm -f /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf;
[ -d ${ModuleInstallPath} ] && cp ${amh_home}/modules/${ModuleName}/my.cnf ${ModuleInstallPath};
${ModuleInstallPath}/bin/mysqld --initialize-insecure --user=mysql --basedir=${ModuleInstallPath} --datadir=/home/usrdata/${ModuleName};
chmod +w /home/usrdata/${ModuleName};
chown -R mysql:mysql /home/usrdata/${ModuleName};
${ModuleInstallPath}/support-files/mysql.server start;

if [ "$MysqlPass" != '' ]; then
${ModuleInstallPath}/bin/mysqladmin -S /tmp/${ModuleName}.sock -u root password $MysqlPass;
sql="USE mysql;DELETE FROM user WHERE User!='root' OR (User = 'root' AND Host != 'localhost');FLUSH PRIVILEGES;";
${ModuleInstallPath}/bin/mysql -uroot -p${MysqlPass} -S /tmp/${ModuleName}.sock -B -N -e "${sql}";
else
sql="USE mysql;DELETE FROM user WHERE User!='root' OR (User = 'root' AND Host != 'localhost');FLUSH PRIVILEGES;";
${ModuleInstallPath}/bin/mysql -uroot -S /tmp/${ModuleName}.sock -B -N -e "${sql}";
fi;

cd /tmp/;
rm -rf /home/usrdata/mysql-${ModuleVersion}/test;
rm -rf /tmp/mysql-${ModuleVersion} /tmp/mysql-${ModuleVersion}.tar.gz;
amh_module_status;
fi;
}

#boot
function amh_module_boot()
{
amh_module_start;
}

#start
function amh_module_start()
{
if amh_module_status ; then
if ! ${ModuleInstallPath}/support-files/mysql.server start; then
cat /home/usrdata/${ModuleName}/*.err;
echo "[Error] $ModuleName start failed.";
return 1;
fi;
else
return 1;
fi;
}

#stop
function amh_module_stop()
{
if amh_module_status ; then
if ! ${ModuleInstallPath}/support-files/mysql.server stop; then
cat /home/usrdata/${ModuleName}/*.err;
echo "[Error] $ModuleName stop failed.";
return 1;
fi;
else
return 1;
fi;
}

#restart
function amh_module_restart()
{
if amh_module_status ; then
if ! ${ModuleInstallPath}/support-files/mysql.server restart; then
cat /home/usrdata/${ModuleName}/*.err;
echo "[Error] $ModuleName restart failed.";
return 1;
fi;
else
return 1;
fi;
}

#check
function amh_module_check()
{
if amh_module_status ; then
${ModuleInstallPath}/bin/mysqld --defaults-file=${ModuleInstallPath}/my.cnf --help --verbose;
status=$?;
echo '--------------------------------------------------------'
cat ${ModuleInstallPath}/my.cnf;
[ "$status" == '0' ] && echo "[OK] ${ModuleName} is ok.";
return $status;
else
return 1;
fi;
}

#uninstall
function amh_module_uninstall()
{
if amh_module_status ; then
if grep ${ModuleName} ${amh_www}/etc/amh-base.conf >/dev/null; then
echo "[Notice] ${ModuleName} Uninstall not allowed.";
return 1;
fi;

${ModuleInstallPath}/support-files/mysql.server stop && \
rm -rf ${ModuleInstallPath} && \
rm -rf /usr/local/include/boost && \
echo "[OK] ${ModuleName} Uninstall successful." && return 0;
return 1;
else
return;
fi;
}

#status
function amh_module_status()
{
if [ -f "${ModuleInstallPath}/bin/mysql" ]; then
echo "[OK] ${ModuleName} is already installed.";
return 0;
else
echo "[Notice] ${ModuleName} is not installed.";
return 1;
fi;
}

  支持 (0分)  反对 (0分)
回复  2016-05-03 14:41:33 6

xxp
铁牌会员
6.00 价值分

[Notice] mysql-5.7 is not installed.
  支持 (0分)  反对 (0分)
回复  2018-03-26 19:19:13 7

hujin1991
铁牌会员
7.19 价值分

我也安装失败,也是显示这个。
  支持 (0分)  反对 (0分)
回复  2018-07-29 18:47:59 8
 1  (总1页)
AMH社区列表
用户服务中心