您好,登錄后才能下訂單哦!
下面講講關于MySQL5.6連接與斷開mysql的詳細方法,文字的奧妙在于貼近主題相關。所以,閑話就不談了,我們直接看下文吧,相信看完MySQL5.6連接與斷開mysql的詳細方法這篇文章你一定會有所受益。
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的詳細方法相關內容,大家還有什么不明白的地方嗎?或者想要了解更多相關,可以繼續關注我們的行業資訊板塊。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。