centos8安装mysql
1.查看之前已安装的Mysql
rpm -qa |grep mysql
2.卸载之前已经安装的Mysql
rpm -e mysql-community-server-5.7
3.下载mysql的rpm
wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
4.安装mysql的rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
5.修改repo文件
cd /etc/yum.repos.d/
vim mysql-community.repo
6.安装Mysql
yum -y install mysql-community-server
7.启动Mysql并查看Mysql状态
systemctl start mysqld.service
systemctl status mysqld.service
8.查看默认密码
grep 'temporary password' /var/log/mysqld.log
9.修改MySQL密码为password
mysql -uroot -p密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
10.修改mysql连接权限,开启远程连接
use mysql;
update user set host = '%' where user ='root';
flush privileges;
quit
11.连接不成功问题
1.检查阿里云3306端口是否配置
2.检查服务器防火墙是否开启,如果开启加入3306端口
- 建议密码复杂度高一些,弱口令容易被攻击,注入木马或者挖矿程序
- redis安装请看另一篇安装教程
|