#!/bin/bash #安装MYSQL yum -y install ncurses-devel yum -y install autoconf tar zxf /cmake-* -C / cd /cmake-* ./configure && gmake && gmake install cd groupadd mysql useradd -M -s /sbin/nologin/ mysql -g mysql tar zxf /mysql-* -C /usr/src cd /usr/src/mysql-* cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all make && make install chown -R mysql:mysql /usr/local/mysql rm -rf /etc/my.cnf cp support-files/my-default.cnf /etc/my.cnf /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile . /etc/profile cp support-files/mysql.server /usr/local/mysql/bin/mysqld.sh chmod +x /usr/local/mysql/bin/mysqld.sh echo "[Unit]" >> /usr/lib/systemd/system/mysqld.service echo "Description=MYSQL Server" >> /usr/lib/systemd/system/mysqld.service echo "After=network.target" >> /usr/lib/systemd/system/mysqld.service echo "[Service]" >> /usr/lib/systemd/system/mysqld.service echo "User=mysql" >> /usr/lib/systemd/system/mysqld.service echo "Group=mysql" >> /usr/lib/systemd/system/mysqld.service echo "Type=forking" >> /usr/lib/systemd/system/mysqld.service echo "PIDFile=/usr/local/mysql/data/localhost.localdomain.pid" >> /usr/lib/systemd/system/mysqld.service echo "ExecStart=/usr/local/mysql/bin/mysqld.sh start" >> /usr/lib/systemd/system/mysqld.service echo "ExecStop=/usr/local/mysql/bin/mysqld.sh stop" >> /usr/lib/systemd/system/mysqld.service echo "[Install]" >> /usr/lib/systemd/system/mysqld.service echo "WantedBy=multi-user.target" >> /usr/lib/systemd/system/mysqld.service systemctl daemon-reload systemctl start mysqld systemctl enable mysqld . /etc/profile
Linux中源码包安装MySQL的shell脚本
原创
©著作权归作者所有:来自51CTO博客作者zw773860471的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
linux源码包的安装
linux的源码包的安装
安装 源码包