如何使用Sequel Pro在macOS上管理MySQL数据库

本文介绍了macOS用户如何使用Sequel Pro这个本机应用程序来管理MySQL数据库。Sequel Pro允许用户创建数据库连接,通过SSH连接,查看数据库结构,编辑内容,执行查询以及查看操作历史。它提供了方便的图形界面,替代了命令行或不安全的web工具,如phpMyAdmin。
摘要由CSDN通过智能技术生成
Sequel Pro Logo

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.

本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。

Many developers who use MySQL for their databases may be pros at managing MySQL databases from the command line, but others really need a visual tool, something with a graphical interface, to use when managing databases. It seems that one of the most common tools used for that purpose is phpMyAdmin. This is a web based tool, one that is installed on your web server. Users can head to a particular address and port, login as a database user, and visually manage databases on that server. While useful, this can be inherently insecure, providing a web interface for MySQL users.

许多将MySQL用于其数据库的开发人员可能是从命令行管理MySQL数据库的专家,但其他开发人员确实需要可视化工具(带有图形界面)才能在管理数据库时使用。 看来,用于此目的的最常用工具之一是phpMyAdmin 。 这是一个基于Web的工具,已安装在Web服务器上。 用户可以访问特定的地址和端口,以数据库用户身份登录,并直观地管理该服务器上的数据库。 尽管很有用,但是从本质上讲这是不安全的,它为MySQL用户提供了一个Web界面。

Another option is MySQL Workbench, a program that can be downloaded for use on many major operating systems, and can remotely connect to databases for management and planning purposes. This post, however, will illustrate the use of a third option for macOS users: Sequel Pro

另一个选择是MySQL Workbench ,该程序可以下载以在许多主要操作系统上使用,并且可以远程连接到数据库以进行管理和规划。 但是,这篇文章将说明macOS用户使用第三个选项的方法: Sequel Pro

.

Sequel Pro is a native application for macOS. You can set up as many database connections as you need in a favorites list, allowing quick access to those which you need to get at repeatedly. Sequel Pro also provides options to use SSH keys from within the application, in order to let you use it to manage databases over SSH, using keys rather than a username and password. This provides significant security advantages over methods that require users to login using only a MySQL user and corresponding password.

Sequel Pro是macOS的本机应用程序。 您可以在收藏夹列表中根据需要设置任意数量的数据库连接,从而可以快速访问需要反复访问的数据库连接。 Sequel Pro还提供了从应用程序中使用SSH密钥的选项,以便让您使用密钥而不是用户名和密码来通过SSH通过SSH管理数据库。 与要求用户仅使用MySQL用户和相应密码登录的方法相比,这提供了显着的安全优势。

使用Sequel Pro (Using Sequel Pro)

Sequel Pro is an easy way to manage your databases on macOS. Getting started is a simple process; you download the application, install it, and then launch Sequel Pro!

Sequel Pro是在macOS上管理数据库的简便方法。 入门是一个简单的过程; 您下载该应用程序,进行安装,然后启动Sequel Pro!

设置新的数据库连接 (Setting up a New Database Connection)

When you launch Sequel Pro, if you have no databases set up yet, you’ll be greeted by the screen that asks you to create a new server connection.

启动Sequel Pro时,如果尚未设置数据库,则会出现询问您创建新服务器连接的屏幕,您会受到欢迎。

Sequel Pro - New DB

The above is the connection information for a standard database, but you can also choose the SSH tab to use SSH to connect to your database, depending on your server’s configuration and security.

上面是标准数据库的连接信息,但是您也可以选择SSH选项卡以使用SSH连接到数据库,具体取决于服务器的配置和安全性。

Sequel Pro - New DB 2

The requested details are relatively straightforward.

要求的详细信息相对简单。

  • Host – The IP or URL used to access the database

    主机 –用于访问数据库的IP或URL

  • Username – The username of a MySQL user (one with the correct permissions to read from or write to the database)

    用户名– MySQL用户的用户名(具有正确的数据库读写权限的用户名)

  • Password – The password of a MySQL user (one with the correct permissions to read from or write to the database)

    密码 – MySQL用户的密码(具有读取或写入数据库的正确权限MySQL用户)

  • Database – The name of the specific database to which you intend to connect

    数据库 –您要连接的特定数据库的名称

  • Port – The port via which to connect to the server. The default is 3306 for a standard MySQL connection.

    端口 –用于连接服务器的端口。 对于标准MySQL连接,默认值为3306。

And if the type of new connection is SSH, you’ll need to provide your SSH host, username, password, and a port (defaults to 22) as well. If you would prefer to use an SSH key, you can click the key icon by the password field to allow the selection of a key file from your Mac’s filesystem.

如果新连接的类型是SSH,则还需要提供SSH主机,用户名,密码和端口(默认为22)。 如果您希望使用SSH密钥,则可以单击密码字段旁边的密钥图标,以允许从Mac的文件系统中选择密钥文件。

Once you’ve connected to your database, you’ll be presented with the Structure View.

连接到数据库后,将显示“结构视图”。

结构图 (Structure View)

Sequel Pro - Structure

The structure view is just what it says – the view that allows you to see, and modify, the structure of the database. Tables are listed on the left, and the right pane contains a list of fields for the currently selected table, and their respective properties. Here you can edit fields, altering their names, giving them default values, altering their encoding schema, altering their maximum length, or making them keys for their table. You can also create new fields in this view.

结构视图就是它所说的内容-使您可以查看和修改数据库结构的视图。 表列在左侧,右窗格包含当前所选表的字段及其各自属性的列表。 在这里,您可以编辑字段,更改其名称,为它们提供默认值,更改其编码架构,更改其最大长度或为它们的表创建键。 您也可以在此视图中创建新字段。

内容检视 (Content View)

Sequel Pro - Content

The content view is where you’ll be looking at or modifying the actual values in your database tables. You can run searches, using the bar and the filters at the top, searching against the values of any field. Records can be modified after being selected, and the plus symbol at the bottom of the window will allow you to add new ones. Editing content here will be familiar to anyone who has used another GUI for editing. It’s a nicer interface than most desktop programs available, though, and very easy to use.

您将在内容视图中查看或修改数据库表中的实际值。 您可以使用栏和顶部的过滤器来运行搜索,以针对任何字段的值进行搜索。 选中记录后即可对其进行修改,并且窗口底部的加号将允许您添加新记录。 使用另一个GUI进行编辑的任何人都将熟悉这里的编辑内容。 但是,它是比大多数可用的桌面程序更好的界面,并且非常易于使用。

查询视图 (Query View)

Sequel Pro - Query

The query view gives you a place where you can write commands, manually run MySQL queries to organize the database, your tables, your records, and the data within them. You’ll also be able to see a query history, allowing you to quickly and easily repeat queries that need to be run more often, for purposes such as testing, maintenance, data searches, backups, or other such reccuring needs. This gives you the functionality of the command line attached to your GUI, just in case you need it!

查询视图为您提供了一个地方,您可以在其中编写命令,手动运行MySQL查询来组织数据库,表,记录以及其中的数据。 您还将能够查看查询历史记录,从而使您能够快速,轻松地重复需要更频繁运行的查询,以用于测试,维护,数据搜索,备份或其他此类递归需求。 这为您提供了附加到GUI的命令行功能,以防万一您需要它!

安慰 (Console)

Sequel Pro - Console

The console gives you a look at the history of your MySQL actions. These logs can help you look back and find mistakes or issues. You can also save your console logs as a file, preserving them for later use.

该控制台使您可以查看MySQL操作的历史记录。 这些日志可以帮助您回顾并发现错误或问题。 您也可以将控制台日志另存为文件,以备以后使用。

结论 (Conclusions)

If you use a Mac for web development and you often have to manage databases, try out Sequel Pro! You can use it to connect to multiple databases on shared hosting or VPS environments alike (and if you’re looking for great hosting, check out our partner, SiteGround). It’s worth the look for a good GUI-based database management program, and it’s absolutely free. Definitely a good tool to have in your macOS development toolkit!

如果您使用Mac进行Web开发,并且经常需要管理数据库,请尝试Sequel Pro! 您可以使用它连接到共享托管或VPS环境中的多个数据库(如果您正在寻找出色的托管,请查看我们的合作伙伴SiteGround )。 值得寻找一个好的基于GUI的数据库管理程序,它是完全免费的。 绝对是macOS开发工具包中的好工具!

翻译自: https://www.sitepoint.com/sequel-pro-manage-mysql-databases/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值