MySQL数据库部署
方式一:仓库安装
rpm -i https:
dnf install mysql-server
rpm -qa | grep mysql
systemctl start mysqld
[root@localhost ~]# mysql -uroot -p
方式二:本地安装
wget https:
tar xvf mysql-8.0.30-1.el8.x86_64.rpm-bundle.tar
dnf localinstall mysql-community-server-8.0.30-1.el8.x86_64.rpm \
mysql-community-client-8.0.30-1.el8.x86_64.rpm \
mysql-community-common-8.0.30-1.el8.x86_64.rpm \
mysql-community-icu-data-files-8.0.30-1.el8.x86_64.rpm \
mysql-community-client-plugins-8.0.30-1.el8.x86_64.rpm \
mysql-community-libs-8.0.30-1.el8.x86_64.rpm
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# mysql -uroot -p
方式三:源码安装(企业常用)
wget https:
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
- Beginning of source-build specific instructions
tar zxvf mysql-VERSION.tar.gz
cd mysql-VERSION
mkdir bld
cd bld
yum install cmake \
gcc-toolset-11-gcc \
gcc-toolset-11-gcc-c++ \
gcc-toolset-11-binutils \
openssl-devel \
ncurses-devel \
libtirpc-devel -y
rpm -i rpcgen-1.3.1-4.el8.x86_64.rpm
cmake .. -DWITH_BOOST=../boost/boost_1_77_0/
- 编译安装(此操作建议在linux终端执行,不要在远程终端执行; 需要编译四个小时左右)
[root@localhost bld]# make;make install
- End of source-build specific instructions
- Postinstallation setup
cd /usr/local/mysql
mkdir mysql-files
chown mysql:mysql mysql-files
chmod 750 mysql-files
bin/mysqld --initialize --user=mysql
bin/mysql_ssl_rsa_setup
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server