CentOS7.9离线安装 MySQL8.0.36文档
下载
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.36-1.el7.x86_64.rpm-bundle.tar
卸载MariaDB
rpm -qa|grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
yum remove mariadb-libs -y
安装
第一步:rpm -ivh mysql-community-common-8.0.36-1.el7.x86_64.rpm
第二步:rpm -ivh mysql-community-client-plugins-8.0.36-1.el7.x86_64.rpm
第三步:rpm -ivh mysql-community-libs-8.0.36-1.el7.x86_64.rpm
第四步:rpm -ivh mysql-community-client-8.0.36-1.el7.x86_64.rpm
第五步:rpm -ivh mysql-community-icu-data-files-8.0.36-1.el7.x86_64.rpm
第六步:rpm -ivh mysql-community-server-8.0.36-1.el7.x86_64.rpm
服务的初始化
mysqld --initialize --user=mysql
cat /var/log/mysqld.log
启动MySQL
启动:systemctl start mysqld.service
关闭:systemctl stop mysqld.service
重启:systemctl restart mysqld.service
开机启动:systemctl enable mysqld.service
查看状态:systemctl status mysqld.service
检查开机启动
systemctl list-unit-files|grep mysqld.service
修改密码
登录数据库
mysql -hlocalhost -P3306 -uroot -p
# 输入初始密码
更新密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
允许访问
update user set host = '%' where user ='root';
连接测试
评论区