我们如何在命令提示符下使用 MySQL 二进制文件来建立 MySQL 数据库?

我们如何在命令提示符下使用 MySQL 二进制文件来建立 MySQL 数据库?

您可以在命令提示符处使用 mysql 二进制文件建立 MySQL 数据库。可以通过以下示例来理解 –

示例

我们可以使用以下语句从命令提示符连接到 MySQL 服务器 –

[root@host]# mysql -u root -p
Enter password:******

这将为我们提供 mysql> 命令提示符,我们可以在其中执行任何 SQL 命令。以下是上述命令的结果 –

以下代码块显示了上述代码的结果 –

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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.

在上面的示例中,我们使用 root 作为用户,但您也可以使用任何其他用户。任何用户都可以执行该用户允许的所有 SQL 操作。

我们可以随时在 mysql> 提示符下使用 exit 命令断开与 MySQL 数据库的连接。

mysql> exit
Bye
原文来自:www.php.cn
© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容