资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

MySQL5.6连接与断开mysql的详细方法-创新互联

下面讲讲关于MySQL5.6连接与断开mysql的详细方法,文字的奥妙在于贴近主题相关。所以,闲话就不谈了,我们直接看下文吧,相信看完MySQL5.6连接与断开mysql的详细方法这篇文章你一定会有所受益。

创新互联建站专注于成县企业网站建设,成都响应式网站建设公司,商城建设。成县网站建设公司,为成县等地区提供建站服务。全流程按需定制设计,专业设计,全程项目跟踪,创新互联建站专业和态度为您提供的服务

3.1 Connecting to and Disconnecting from the Server

3.1连接和断开与云服务器的连接

To connect to the server, you will usually need to provide a MySQL user name when you invoke mysql and, most likely, a password. If the server runs on a machine other than the one where you log in, you will also need to specify a host name. Contact your administrator to find out what connection parameters you should use to connect (that is, what host, user name, and password to use). Once you know the proper parameters, you should be able to connect like this:

为了连接服务,你通常需要提供一个MySQL用户名,可能还需要密码。如果服务不在你所登陆的fu wu qish云服务器上运行,你还需要指定云服务器的主机名(或IP地址)。请与您的管理员联系,找出您应该使用哪些连接参数进行连接(即要使用的主机名,用户名和密码)。一旦你知道正确的参数,你应该可以这样连接:

shell> mysql -h host -u user -pEnter password: ********

host and user represent the host name where your MySQL server is running and the user name of your MySQL account. Substitute appropriate values for your setup. The ******** represents your password; enter it when mysql displays the Enter password: prompt.

If that works, you should see some introductory information followed by a mysql> prompt:

host和user 象征着MySQL云服务器的主机名和MySQL账户的用户名。为您的设置替换成适当的值。********代表你的密码; 当mysql显示Enter password:提示时输入。

如果配置正确,你应该看到一些介绍性信息,然后是一个mysql>提示:

shell> mysql -h host -u user -pEnter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 25338 to server version: 5.6.38-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>

The mysql> prompt tells you that mysql is ready for you to enter SQL statements.

If you are logging in on the same machine that MySQL is running on, you can omit the host, and simply use the following:

mysql>提示 告诉你MySQL已经准备好让您输入SQL语句了。

假如MySQL运行的云服务器与你登陆的设备是同一台,你可以省略主机名设置,只需使用以下命令:

shell> mysql -u user -p

If, when you attempt to log in, you get an error message such as ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2), it means that the MySQL server daemon (Unix) or service (Windows) is not running. Consult the administrator or see the section of Chapter 2, Installing and Upgrading MySQL that is appropriate to your operating system.

For help with other problems often encountered when trying to log in, see Section B.5.2, “Common Errors When Using MySQL Programs”.

Some MySQL installations permit users to connect as the anonymous (unnamed) user to the server running on the local host. If this is the case on your machine, you should be able to connect to that server by invoking mysqlwithout any options:

如果您尝试登录时会收到错误消息(如 ERROR 2002(HY000)):无法通过套接字'/tmp/mysql.sock'(2)连接到本地MySQL云服务器,这意味着MySQL云服务器守护进程(Unix)或服务(Windows)未运行。请咨询管理员或参阅 第2章适用于您的操作系统的安装和升级MySQL部分。

有关尝试登录时经常遇到的其他问题的帮助,请参见第B.5.2节“使用MySQL程序时的常见错误”。

一些MySQL安装允许用户作为匿名(未命名)用户连接到在本地主机上运行的云服务器。如果您的机器是这种情况,您应该能够通过调用mysql连接到该云服务器,而不需要任何选项:

shell> mysql

After you have connected successfully, you can disconnect any time by typing QUIT (or \q) at the mysql> prompt:

连接成功后,您可以通过在提示符下键入QUIT(或\q)断开连接mysql>:

mysql> QUIT
Bye

On Unix, you can also disconnect by pressing Control+D.

Most examples in the following sections assume that you are connected to the server. They indicate this by themysql> prompt.

在Unix上,也可以通过按Control + D断开连接。

以下部分中的大多数示例假定您已连接到云服务器。他们通过mysql>提示来表示这一点 。

对于以上MySQL5.6连接与断开mysql的详细方法相关内容,大家还有什么不明白的地方吗?或者想要了解更多相关,可以继续关注我们的行业资讯板块。

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


标题名称:MySQL5.6连接与断开mysql的详细方法-创新互联
分享地址:http://cdkjz.cn/article/jsdgi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220