netnr / install-mysql8.md
2020-09-03 06:37
CentOS7 安装 MySQL8
### 清理 ``` # 查找并删除mysql(原本的残留) rpm -qa | grep mysql # 查找 yum remove 软件包名 # 删除 # 查找并删除mariaDB rpm -qa | grep mariadb # 查找 rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64 # 删除 # 查找并删除mysql配置文件 find / -name mysql # 查找 rm -rf /usr/lib64/mysql # 删完 ``` ### 安装 ``` rpm -ivh https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm # 安装repo文件 yum clean all # 更新yum缓存 yum makecache yum list | grep mysql # 查看可用 yum install mysql-community-server # 安装 systemctl status mysqld # 查看mysql状态 systemctl enable mysqld # 设置mysql开机自动启动 grep 'temporary password' /var/log/mysqld.log # 查找临时密码 mysql -uroot -p # 连接 alter user user() identified by "123"; # 设置密码 # 允许远程访问 use mysql; select host,user from user; UPDATE user SET Host='%' WHERE User='root' AND Host='localhost' LIMIT 1; flush privileges; ``` ### help https://blog.csdn.net/qq_40243950/article/details/106651484
ˆ