mysql编译安装byblackmed简析
下文内容主要给大家带来MySQL 编译安装 by blackmed简析,这里所讲到的知识,与书籍略有不同,都是创新互联专业技术人员在与用户接触过程中,总结出来的,具有一定的经验分享价值,希望给广大读者带来帮助。
成都创新互联-专业网站定制、快速模板网站建设、高性价比桃源网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式桃源网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖桃源地区。费用合理售后完善,十载实体公司更值得信赖。
#!/usr/bin/env bash
#mysql 编译安装 by blackmed
byhe(){
rpm -qa | grep mariadb
if [ $? -eq 0 ];then
rpm -e --nodeps >/dev/null
fi
rm -rf /etc/my* >/dev/null
rm -rf /var/lib/mysql >/dev/null
userdel -r mysql >/dev/null
rpm -qa | grep cmake
if [ $? -ne 0 ];then
yum -y install cmake ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make >/dev/null
echo "========================================"
echo "The success of the prophase environment."
echo "========================================"
fi
useradd -r mysql -M -s /sbin/nologinmkdir /mysql
wget -O /mysql/mysql-5.7.20.tar.gz https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.20.tar.gz >/dev/null
tar xvf /mysql/mysql-5.7.20.tar.gz -C /mysql/
cd /mysql/mysql-5.7.20
cmake .
-DDOWNLOAD_BOOST=1
-DWITH_BOOST=boost_1_59_0/
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DSYSCONFDIR=/etc
-DMYSQL_DATADIR=/usr/local/mysql/data
-DINSTALL_MANDIR=/usr/share/man
-DMYSQL_TCP_PORT=3306
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DDEFAULT_CHARSET=utf8 -DEXTRA_CHARSETS=all
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_READLINE=1 -DWITH_SSL=system
-DWITH_EMBEDDED_SERVER=1
-DENABLED_LOCAL_INFILE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
make && make install
echo "==========================="
echo "mysql install successfully"
echo "==========================="
chown -R mysql.mysql /usr/local/mysql/
local_mysql=/usr/local/mysql/bin
${local_mysql}/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
mima=`${local_mysql}/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data | awk '/localhost\:/{print $NF}' `
touch /etc/my.cnf
echo "[mysqld]" >> /etc/my.cnf
echo "basedir=/usr/local/mysql" >> /etc/my.cnf
echo "datadir=/usr/local/mysql/data" >> /etc/my.cnf
sed -i '/PATH=/cPATH=$PATH:$HOME/bin:/usr/local/mysql/bin' ~/.bash_profile
source ~/.bash_profile
mysqld_safe --user=mysql &
mysqladmin -u root -p${mima} password 1
echo "==============================================="
echo "Initialization completion can be used normally."
echo "==============================================="
}
byhe
对于以上关于mysql 编译安装 by blackmed简析,如果大家还有更多需要了解的可以持续关注我们创新互联的行业推新,如需获取专业解答,可在官网联系售前售后的,希望该文章可给大家带来一定的知识更新。
名称栏目:mysql编译安装byblackmed简析
网站URL:http://myzitong.com/article/gehhih.html