使用Navicat连接阿里云服务器上的MySQL数据库

1 开放阿里云服务器的3306端口:在安全组配置处开放3306端口



2 mysql授权

# 默认情况下,mysql用户不允许从远程登录,只能在localhost登录。需要我们进入mysql进行授权
# 步骤1:切换到mysql数据库
use mysql;

# 步骤2:通过如下查询语句来显示所有的用户
select user,host from user;

# 步骤3:修改root 的host值,将host设置为%表示任何ip都能连接mysql
update user set host='%' where user='root' and host='localhost';

# 步骤4:再次通过以下查询语句来显示所有的用户
select user,host from user;



3 使用Navicat连接

(1) 步骤1:打开本地navicat,点击数据库连接,点击 SSH
主机名或IP地址:填远程服务器的ip地址
端 口: 填远程服务器的端口(注意不是mysql的端口)
用 户 名:填远程服务器的用户名
密 码:填远程服务器的连接密码



(2) 步骤2:不要关闭该连接窗口,点击左上角的【常规】连接 名:填任意名称主机名或IP地址:填localhost或者127.0.0.1端 口: 填远程服务器上的mysql开放端口,一般情况下是3306用户 名:填远程服务器上的mysql的用户名密 码: 填远程服务器上的mysql的密码 。




(3) 步骤3:操作结果




相关推荐

  • 生成图片

    from PIL import Image, ImageColor, ImageDraw, ImageFont, ImageFilterdef create_image_with_text(size, color, text, font_path, font_size, text_color, shadow_color, output_path): """ Create a new image of specified size and color with centered text that has a border and shadow. :param size: A tuple con

  • 获取指定目录下的所有图片信息

    1 获取指定目录下的所有图片信息// 获取指定目录下的所有图片信息 public function getImagesInfo($directory) { $images = []; // 创建递归目录迭代器 $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY ); // 遍历目录中的每个文件 foreach (

  • Thinkphp各版本的PHP要求

    ThinkPHP 8.0:运行环境要求PHP8.0+,兼容PHP8.3ThinkPHP 6.1:运行环境要求PHP7.2+,兼容PHP8.1ThinkPHP 6.0:运行环境要求PHP7.2+,兼容PHP8.1ThinkPHP 5.1:运行环境要求PHP5.6+,兼容PHP8.0ThinkPHP 5.0:运行环境要求PHP5.4+,兼容PHP7.3