这篇文章将为大家详细讲解有关MySQL怎么进行安装部署,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
rpm -qa|grep mariadb yum remove mariadb-libs -y rm -rf /etc/my.cnf
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz yum install -y libaio-devel
tar zxf mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz -C /opt/ mv /opt/mysql-5.7.28-linux-glibc2.12-x86_64 /opt/mysql-5.7.28
ln -s /opt/mysql-5.7.28 /opt/mysql
echo 'export PATH=$PATH:/opt/mysql/bin' >>/etc/profile source /etc/profile mysql -V
ccat> /etc/my.cnf <<EOF [mysqld] port=3306 user=mysql basedir=/opt/mysql datadir=/data/mysql_3306 socket=/tmp/mysql_3306.sock [mysql] socket=/tmp/mysql_3306.sock EOF
mkdir -p /data/mysql_3306
useradd -s /sbin/nologin -M mysql
chown -R mysql:mysql /data/ chown -R mysql:mysql /opt/mysql*
mysqld --initialize-insecure --user=mysql --basedir=/opt/mysql --datadir=/data/mysql_3306/
cp /opt/mysql/support-files/mysql.server /etc/init.d/mysqld chkconfig --add mysqld systemctl start mysqld
netstat -lntup|grep 3306 mysql
mkdir -p /data/mysql_330{7,8} chown -R mysql:mysql /data/mysql_330*
mysqld --initialize-insecure --user=mysql --basedir=/opt/mysql --datadir=/data/mysql_3307/ mysqld --initialize-insecure --user=mysql --basedir=/opt/mysql --datadir=/data/mysql_3308/
cat >/data/mysql_3307/my.cnf <<EOF [mysqld] port=3307 user=mysql basedir=/opt/mysql datadir=/data/mysql_3307 socket=/tmp/mysql_3307.sock [mysql] socket=/tmp/mysql_3307.sock EOF cat >/data/mysql_3308/my.cnf <<EOF [mysqld] port=3308 user=mysql basedir=/opt/mysql datadir=/data/mysql_3308 socket=/tmp/mysql_3308.sock [mysql] socket=/tmp/mysql_3308.sock EOF
cat >/etc/systemd/system/mysqld_3307.service <<EOF [Unit] Description=MySQL Server Documentation=man:mysqld(8) Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql ExecStart=/opt/mysql/bin/mysqld --defaults-file=/data/mysql_3307/my.cnf LimitNOFILE = 5000 EOF cat >/etc/systemd/system/mysqld_3308.service <<EOF [Unit] Description=MySQL Server Documentation=man:mysqld(8) Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html After=network.target After=syslog.target [Install] WantedBy=multi-user.target [Service] User=mysql Group=mysql ExecStart=/opt/mysql/bin/mysqld --defaults-file=/data/mysql_3308/my.cnf LimitNOFILE = 5000 EOF
systemctl daemon-reload systemctl start mysqld_3307.service mysqld_3308.service
netstat -lntup|grep 330*
mysqladmin password -S /tmp/mysql_3307.sock mysqladmin password -S /tmp/mysql_3308.sock
mysql -S /tmp/mysql_3307.sock -p mysql -S /tmp/mysql_3308.sock -p
关于“MySQL怎么进行安装部署”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。