【问题标题】:mysql - can't run commands in terminal?mysql - 无法在终端中运行命令?
【发布时间】:2016-08-24 17:58:24
【问题描述】:

我是数据库和 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
    ->

有什么问题?

【问题讨论】:

    标签: mysql sql macos


    【解决方案1】:

    我相信您可能只是缺少分号

    create database test;
    

    【讨论】:

    • 很抱歉再次打扰。添加分号后,会创建一个数据库,我可以看到它出现在运行show databases; 的结果中。但是文件在哪里?我在主目录下运行mysql,但在里面找不到数据库文件?
    • 我相信这将解释数据库的位置stackoverflow.com/questions/26402884/… 我建议寻找一个速成课程类型的教程来熟悉使用数据库,比如mysqltutorial.org
    猜你喜欢
    • 2013-09-18
    • 1970-01-01
    • 2017-06-28
    • 1970-01-01
    • 2020-08-24
    • 2022-01-22
    • 2021-06-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多