2016-04-29 66 views
0

我是新來的數據庫和MySQL。mysql - 無法在終端中運行命令?

運行sudo mysql -u root -p並鍵入我的密碼後,我成功進入mysql。 (我在Mac OS X 10.10下。)

但是,當我嘗試創建數據庫時,出現了錯誤。

$ mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 16 
Server version: 5.6.23 MySQL Community Server (GPL) 

Copyright (c) 2000, 2015, 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> create database test 
    -> exit 
    -> 

什麼問題?

回答

1

我相信,你可能只是缺少分號

create database test; 
+0

不好意思再打擾。在添加分號後,會創建一個數據庫,我可以看到它出現在運行'show databases;'的結果中。但該文件在哪裏?我在主目錄下運行mysql,但無法找到它的數據庫文件? –

+0

我相信這將解釋數據庫的位置http://stackoverflow.com/questions/26402884/where-does-mysql-store-data我會建議尋找一個崩潰的課程類型教程,以獲得一般熟悉使用數據庫就像http://www.mysqltutorial.org一樣 –