Centos7 安装MySQL8

系统
CentOS 7.4

安装软件
MySQL8.0.11

下载MySQL yum源
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
安装yum源
yum localinstall mysql80-community-release-el7-1.noarch.rpm

更新yum源
yum clean all
yum makecache
开始安装MySQL
yum install mysql-community-server
启动MySQL,查看MySQL状态,设置为开机自启动
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
查看初始化密码
cat /var/log/mysqld.log | grep password

截图如下:

#防火墙开放3306端口
[root@localhost ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
success
[root@localhost ~]# firewall-cmd --reload
success
登入MySQL
mysql -u root -p

如果提示如下错误:

[root@localhost ~]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

请查看解决办法:https://blog.csdn.net/zhouzhiwengang/article/details/87378046

你可能感兴趣的:(CentOS,随手笔记)