Linux服务器MySQL安装
1. MySQL官网下载如图:
2. 安装MySQL
[[email protected] /]# rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch
过滤MySQL:
[[email protected] /]#yum repolist all |grep mysql
enabled是已经开启的,现在安装mysql57-community,把disabled设置为enabled
看看都装了什么:[[email protected] /]#rpm -ql mysql80-community-release
安装
查看manager: [[email protected] /]#yum provides yum-config-manager
mysql80-community禁止:[[email protected] /]# yum-config-manager --disable mysql80-community
mysql57-community开启:[[email protected] /]# yum-config-manager --enable mysql57-community
查看结果:
[[email protected] /]# yum repolist all |grep community/x86_64
安装MySQL:
[[email protected] /]# yum install mysql-community-server -y
2. 启动: [[email protected] /]# systemctl start mysqld
3.要马上修改密码,首先查找默认的密码:
[[email protected] /]# grep "password" /var/log/mysqld.log
4. 进入mysql:
[[email protected] /]# mysql -uroot -p"lpdIi.82Dxky"
5. 修改密码:
[[email protected] /]# alter user [email protected]‘localhost‘ identified by ‘新密码‘;
密码不要太简单,不然会出现下面错误:
6. 授权:
[[email protected] /]# grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘Bgx123.com‘;
[[email protected] /]# flush privileges;
7. 启动mysql
[[email protected] /]# systemctl start mysqld
[[email protected] /]# service mysqld restart
8. navicat 连接mysql:
一定要关闭防火墙:[[email protected] /]# systemctl stop firewalld.service
还要注意阿里云服务器对mysql端口开放
原文地址:https://www.cnblogs.com/changlai/p/11328330.html