Linux服务器MySQL安装
Posted changlai
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux服务器MySQL安装相关的知识,希望对你有一定的参考价值。
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端口开放
以上是关于Linux服务器MySQL安装的主要内容,如果未能解决你的问题,请参考以下文章