CentOS7 安装mysql并解决安装慢的问题

0、centOS7 mini版安装及网络配置

//可从我的网盘保存下载,可用虚拟机安装
链接:https://pan.baidu.com/s/10_AHxN0DtJ75s1oFOaaZ3A  密码:udsn
//初始用户名是root,密码自己安装前设置 

//安装网络查看工具ifconfig
yum install net-tools

//本地电脑ssh获取ip连接

1 、下载并安装MySQL官方的 Yum Repository

wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql57-community-release-el7-10.noarch.rpm

yum -y install mysql-community-server

2、发现安装太慢

//1、去国内镜像站下载对应版本的client和server rpm包
推荐:http://uni.mirrors.163.com/mysql/Downloads/

//2、cd到目录
/var/cache/yum/x86_64/7/mysql57-community/packages/

//3、把下载好的rpm文件上传到此目录
mysql-community-client-5.7.29-1.el7.x86_64.rpm
mysql-community-server-5.7.29-1.el7.x86_64.rpm

//4、再次执行安装命令
yum -y install mysql-community-server

3、 MySQL数据库设置

//开启MySQL
systemctl start  mysqld.service

//获取临时密码
grep "password" /var/log/mysqld.log

//进入数据库
mysql -uroot -p

//修改密码验证规则
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;

//设置简单密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

4、 卸载mysql安装更新

yum -y remove mysql57-community-release-el7-10.noarch

5、 彻底解决python mysqlclient 安装失败的问题

cd /etc/yum.repos.d/

rpm -ivh http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

sudo yum install mysql-devel

sudo yum install python3-devel

pip install mysqlclient

6、 解决pycharm与远程服务器库不一致的问题

保证远程interpreter的项目映射地址和tools->deployment里的map映射地址一致

如果还不更新,点击interpreter右上角reset刷新即可

posted @ 2020-04-16 10:16  Erick-LONG  阅读(4260)  评论(0编辑  收藏  举报