分类: Mysql/postgreSQL
2008-02-12 13:44:15
本章主要内容:
· MySQL directory structure
· Overview of executables
· Overview of user interfaces
· Quick introduction to the MySQL monitor
Linux默认安装目录: /usr/local/mysql windows 为C:\mysql. 包含了bin, scripts,data,docs, sql-bench等目录
其他目录有:share (包含错误信息), and examples (Windows 下面才有, 使用 libmysql DLL)等.
Bin目录有如下重要工具
Mysqladmin,myisamchk,mysqldump,mysqlbinlog,mysqlshow,其中mysqlbinlog用于读取二进制log,在灾难恢复的时候尤其有用.
scripts目录包含了脚本,比如mysqlhotcopy是个很有用的perl脚本,5.0已经在bin目录中.
用户接口有:
command-line interface mysql (also known as the MySQL monitor), MySQL Control Center (MySQLCC for short), and phpMyAdmin
其中MySQLCC,MySQLCC使用Qt windowing toolkit,是跨平台的工具。
phpMyAdmin基于web
mysql --i-am-a-dummy -u root不会对数据库进行改变
语句后面要使用分号,\g也是一样的结果
常用操作:
show databases;
use databasename;
show tables;
describe tablename;
\h
source filename
mysql -u username -p < filename
· MYSQL最重要的目录是bin,data,docs
· 使用最多的程序是mysqld, mysql, 分别为服务器和客户端
· 访问mysql的客户端有: mysql (command-line), MySQLCC (GUI), and phpMyAdmin (Web-based).
· Mysql客户端重要的命令行参数有:-u,-p,-h, --i-am-a-dummy
· The mysql command-line program has many useful command-line
· 查看数据库SHOW DATABASES ;查看表 SHOW TABLES ;查看表的字段
· 退出使用 \q.
·
语句结束 ; or \g
· 可以使用文件重定向执行命令文件.
· The most important directories in your MySQL installation are bin (executable programs), data (database data), and docs (documentation).
· The two programs you will use the most are mysqld, the MySQL server, and mysql, the command-line client.
· You have a choice of several user interfaces/client programs. We discussed mysql (command-line), MySQLCC (GUI), and phpMyAdmin (Web-based).
· The mysql command-line program has many useful command-line switches and options. We have discussed -u (to specify username), -p (to log in with a password), -h (to specify the host), and --i-am-a-dummy (for damage-control mode).
· When logged in, you can use SHOW DATABASES or SHOW TABLES to get a list of what is in the system and DESCRIBE tablename to get information about a particular table.
· You can log out with \q.
· You can terminate commands with ; or \g to send them to the server for execution.
· You can execute a file of commands from inside the client with source filename and from outside the client by using file redirection.
chinaunix网友2008-02-12 13:45:31
§2.3 习题和答案 Quiz 1: You would find the MySQL server program in the docs or Docs directory the lib directory the scripts directory the bin directory 2: You would find the MySQL documentation in the docs or Docs directory the lib directory the scripts directory the bin directory 3: You would find mysqlhotcopy in the docs or Docs directory the lib directory the scripts directory the bin directory 4: Commands in the MySQL monitor should be terminat