1.一些基本概念
1)MySQL体系结构由五个主子系统组成:查询引擎、存储管理器、缓冲管理器、事务管理器和恢复管理器。
2)查询引擎包含三个相关联的部件:语法分析器、查询优化器和执行部件。
3)除五个主子系统以外,MySQL体系结构还包括两个辅助部件:过程管理器和函数库。
4)在MySQL中,事务的开始标记为一个BEGIN语句(与Oracle不同)。
2.安装完成后修改MySQL root用户口令
C:Documents and SettingsAdministrator>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 18
Server version: 5.1.34-community MySQL Community Server (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> use mysql
Database changed
mysql> set password for 'root'@'localhost' = password('passwd');
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N
O)
C:Documents and SettingsAdministrator>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 20
Server version: 5.1.34-community MySQL Community Server (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
3.修改数据文件存放路径
先关闭MySQL服务器:
C:Documents and SettingsAdministrator>mysqladmin -u root -p shutdown
Enter password: ******
修改my.ini配置文件(默认放在 D:Program FilesMySQLMySQL Server 5.1 下)中的datadir参数:
#Path to the database root
datadir="D:MySQL Datafilesdata"
启动MySQL服务器,可以通过启动系统服务的方法。
4.一系列简单操作
1)创建数据库,查看数据库,选择想要使用的数据库
mysql> create database ggyy;
Query OK, 1 row affected (0.43 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ggyy |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ggyy |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use ggyy
Database changed
2)创建表,查看表
mysql> create table members
-> (
-> id int(3) auto_increment,
-> fname varchar(20) not null,
-> lname varchar(20) not null,
-> tel varchar(15),
-> email varchar(50),
-> primary key (id)
-> );
Query OK, 0 rows affected (0.49 sec)
mysql> show tables;
+----------------+
| Tables_in_ggyy |
+----------------+
| members |
+----------------+
1 row in set (0.01 sec)
注:auto_increment修饰符只适用于整型字段,表明MySQL将要为这个字段自动生成一个数字(通过对前面的值增加1)。一个表只能有一个auto_increment字段,而且这个字段必须被定义为键(即字段上必须有索引,术语“键”和“索引”在MySQL中是等同的)。
这时可以在数据文件的存放路径下看到新生成的文件:
D:MySQL Datafilesdataggyy>dir
Volume in drive D is Data
Volume Serial Number is D632-9209
Directory of D:MySQL Datafilesdataggyy
2009-05-18 10:58
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11662464/viewspace-1030650/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11662464/viewspace-1030650/