您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)MySQL怎么進(jìn)行安裝部署,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
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
關(guān)于“MySQL怎么進(jìn)行安裝部署”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。