Bootstrap

mysql安装---rpm包

1.1安装mysql
1.1.1 检查依赖
rpm -qa | grep libaio
rpm -qa | grep net-tools
rpm -qa | grep perl
yum install -y net-tools perl (如果没安装,则需要安装)
1.1.2 卸载mariadb
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
1.1.3.开始安装
mkdir mysql
tar xvf mysql-8.0.39-1.el7.x86_64.rpm-bundle.tar -C mysql
cd mysql
rpm -ivh mysql-community-common-8.0.39-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.39-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.39-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.39-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.39-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.39-1.el7.x86_64.rpm
mysqld --initialize --console --user=mysql  #初始化
1.1.4 检查是否安装成功
rpm -qa | grep mysql
mysql --version
systemctl status mysqld
1.1.5启动并开机自启
systemctl start mysqld
systemctl enable mysqld
1.1.6 查看初始化密码
cat /var/log/mysqld.log | grep password
1.1.7 修改密码并登陆
mysqladmin -uroot -p'初始化密码' password '新密码'
mysql -uroot -p'新密码'
;