阿里云Ubuntu18.04下安装mysql5.7并设置远程连接

根据网上的教程,实现了在Ubuntu18.04下安装mysql5.7并通过远程连接,以下为学习笔记:
1. 安装

sudo apt-get update
sudo apt-get install mysql-server
sudo apt-get install mysql-client

2. 修改root账号的host字段为%

mysql -uroot -ppassword
mysql>use mysql
mysql>update user set host='%' where user='root'; 

3. 给任意主机root账户连接mysql服务器权限

mysql>GRANT ALL PRIVILEGES ON *.*  TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql>flush privileges; 
mysql>exit;

4. 修改mysql配置文件

sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉bind-address = 127.0.0.1

5. 重启MySQL服务

sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start

6. 开放服务器3306端口,并重启服务器在这里插入图片描述

7. 修改mysql的密码

mysql
mysql>use mysql;
mysql>update user set authentication_string=PASSWORD("这写你设置的密码")where user='root';
mysql>update user set plugin="mysql_native_password";
mysql>flush privileges;
mysql>quit;

8. 通过Navicat远程连接
用户名:root
密码:刚才设置的密码

参考文献:
[1]Ubuntu18.04下安装mysql5.7超详细步骤>>https://www.cnblogs.com/weijianyi/p/11599381.html
[2]阿里云Ubuntu18.04配置jdk 8,tomcat 8.5,mysql 5.7,并把Javaweb项目部署到服务器上附xshell和winscp下载地址>>https://blog.csdn.net/weixin_43958091/article/details/96759562
谢谢大神!

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值