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