2012-11-17 38 views

回答

2

。假定在* nix站上的BASH狀殼:

mysql -h<hostname> -u<username> -p<password> 

的-h可以跳過對本地主機。如果您正在處理遠程主機,則必須將其配置爲偵聽外部接口,並且必須能夠訪問遠程主機上該接口上的端口3306。用戶名是根或數據庫/模式特定的密碼。

12:02:26 [email protected]:~ 
$ mysql -htiny -uroot -p################ 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 2710 
Server version: 5.5.28-0ubuntu0.12.10.1-log (Ubuntu) 

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. 

Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> show databases; 
+--------------------+ 
| Database   | 
+--------------------+ 
| information_schema | 
| Assessor   | 
| mysql    | 
| performance_schema | 
| test    | 
| ... contd.   | 
+--------------------+ 
12 rows in set (0.10 sec) 

mysql> 
+0

它說你有你的SQL語法錯誤。你給我的第一行不在mysql命令行上工作 – user1781232

+0

一旦進入mysql客戶端,只需輸入'help'。或者,https://dev.mysql.com/doc/上的RTFM。 – justinzane

相關問題