Home >Database >Mysql Tutorial >MYSQL教程:新手该看的MYSQL操作_MySQL

MYSQL教程:新手该看的MYSQL操作_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:55:16788browse

  如果MYSQL运行在服务器上,而你在客户端需要连接的化,需要按如下方式进行连接:

  shell>mysql -h host -u user -p

  Enter password:************

  host和user分别代表MySQL服务器运行的主机名和MySQL帐户名.添写时写上对应的机器的名称和MySQL用户名. *********代表你的密码.

  如果有效,你会看到如下提示:

  Welcome to the MySQL monitor. Commands end with ; or g.

  Your MySQL connection id is 7 to server version: 5.0.18-nt

  Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

  mysql>

  mysql>提示符告诉你该输入命令了.

  有些时候MySQL会允许你匿名登陆到服务器上,此时直接输入mysql即可.

  shell> mysql

  成功连接后,可在mysql>提示下输入quit随时退出:

  mysql> quit

  Bye

  下面显示一个简单的查询实例,这是一个简单命令,要求得到服务器的版本号和当前日期:

  mysql> select version(), current_date;

  +-----------+--------------+

  | version() | current_date |

  +-----------+--------------+

  | 5.0.18-nt | 2006-07-29 |

  +-----------+--------------+

  1 row in set (0.00 sec)

  mysql>

  在这里我们要明白:

  一个命令通常由SQL语句组成,随后跟着一个分号.

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