MySQL通常用Telnet进行登录(一个非常好的Telnet软件名为Easyterm,可以从 http://www.arachnoid.com/下载)。我们向用户推荐使用WinMysql 管理工具,下载网址是http://www.tcx.se/Downloads/Win32/myAdmin1.0.1.0.zip 通过Telnet与web服务器连接后,第二个命令提供MySQL服务器的登录。登录的步骤如下:
1. 连接到服务器。
--------------------------------------------------------------------------------
login: devshed
Password: ********
Last login: Wed Aug 12 09:49:14 from 195.103.124.222
Copyright 1992, 1993, 1994, 1995, 1996 Berkeley Software Design, Inc.
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.
BSDI BSD/OS 2.1 Kernel #12: Mon Feb 23 13:46:27 EST 1998
You have new mail.
www24:mywww/devshed#
--------------------------------------------------------------------------------
2. 登录到MySQL帐户。
--------------------------------------------------------------------------------
www24:mywww/devshed# mysql -u devshed -p
--------------------------------------------------------------------------------
Syntax: mysql -h hostname -u username -p[password]
Or
mysql -h hostname -u username --password=password
用户会被提示输入密码。-p表示输入密码。
--------------------------------------------------------------------------------
Enter password: *******
--------------------------------------------------------------------------------
用户会看见如下结果:
--------------------------------------------------------------------------------
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 49 to server version: 3.21.23-beta-log
Type help for help.
mysql>
--------------------------------------------------------------------------------
登录到数据库之后,我们就可以执行各种MySQL的命令,但在对数据库操作之前必须要先调用数据库,也就是与数据库建立连接:
--------------------------------------------------------------------------------
mysql> use devshed;
--------------------------------------------------------------------------------
结果:
--------------------------------------------------------------------------------
Database changed
Mysql>
--------------------------------------------------------------------------------
现在你已经连接到数据库。注意命令后面要加上分号(;),几乎所有的MySQL命令都要加分号。有关管理数据库的命令可以通过键入help, \h 或?列出来。
--------------------------------------------------------------------------------
mysql> help
help (\h) Display this
text ? (\h) Synonym for `help
clear (\c) Clear command
connect (\r) Reconnect to the server. Optional arguments are db and host
edit (\e) Edit command with $EDITOR
exit (\) Exit mysql. Same as quit
go (\g) Send command to mysql server
print (\p) print current command
quit (\q) Quit mysql
rehash (\#) Rebuild completion hash
status (\s) Get status information from the server
use (\u) Use another database. Takes database name as argument
Connection id: 49 (Can be used with mysqladmin kill)
mysql>
--------------------------------------------------------------------------------
也许这些功能不会都能用上,但应该知道每一个命令都会做什么。象命令status, use, print, connect, clear, 和quit在最开始学习使用时都会十分有用。现在,你应该对连接数据库、选择数据库和运行基本命令都应该有一定的了解。下一步将讲解有关对数据库进行操作的基本概念和方法。
服务器租用托管联系亿恩小易:1355017510QQ
本文出自:亿恩科技【www.enkj.com】
服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]
|