Home >Database >Mysql Tutorial >MySQL学习笔记之一_MySQL

MySQL学习笔记之一_MySQL

WBOY
WBOYOriginal
2016-05-27 14:12:241005browse

bitsCN.com

MySQL装有一个名为mysql的命令行,在提示符下输入mysql将出现如下的简单提示:

  ~  mysqlWelcome to the MySQL monitor.  Commands end with ; or /g.Your MySQL connection id is 135Server version: 5.5.35-0ubuntu0.13.10.1 (Ubuntu)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> 

mysql的命令行参数一般有:

-u 用户名

-p 密码

-h 主机名

-P 端口号

例如:mysql -u root -p -h localhost -P 3306

命令行会提示你输入密码

Enter password: 

也可以直接输入密码,mysql -p123456 或者mysql --password=123456

进入mysql后,SHOW DATABASES显示数据库信息,USE DATABASE进入数据库,SHOW TABLES显示table信息。

要显示某一table的列信息,SHOW COLUMNS FROM table或者DESCRIBE table。

其它的SHOW用法:

SHOW STATUS:显示服务器信息

SHOW GRANTS:显示用户的权限

SHOW ERRORS,SHOW WARNINGS,显示错误或警告信息。

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn