mysql (Noinstall 版本) 学习

今天准备弄一下mysql,下载了一个免安装的版本。是 win32版本,我的操作系统是win xp

下面是我学习的过程,都是我一步一步测试的,如果有错误,请指正!
[color=gray]
[size=small]想赚钱的朋友,可以看[url=http://zgqhyh.iteye.com/blog/469033]程序员赚钱方法探讨[/url][/size][/color]

[b]1、下载[/b]
下载地址是:[url]http://dev.mysql.com/downloads/mysql/5.1.html#win32[/url]
选择 [b]Without installer (unzip in C:\) 5.1.39 112.6M
[/b] 这个进行下载

[b]2、解压[/b]

解压到一个你指定的地方,最好别放在系统盘,不然操作系统一出问题.....

[b]3、启动数据库[/b]
首先进入命令行窗口(注意,进入你的解压的路径,不一定和我的相同)
[b]
d:
cd D:\Program Files\mysql-5.1.39-win32\bin
D:\Program Files\mysql-5.1.39-win32\bin>mysqld --console[/b]

执行完上述操作后,你会看到
[b]
090929 22:13:43 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
090929 22:13:43 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
090929 22:13:43 InnoDB: Log file .\ib_logfile0 did not exist: new to be created

InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
090929 22:13:43 InnoDB: Log file .\ib_logfile1 did not exist: new to be created

InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
090929 22:13:44 InnoDB: Started; log sequence number 0 0
090929 22:13:45 [Note] Event Scheduler: Loaded 0 events
090929 22:13:45 [Note] mysqld: ready for connections.
Version: '5.1.39-community' socket: '' port: 3306 MySQL Community Server (GPL
)
[/b]

到此:服务已经启动了。
保持这个窗口不要关闭。

[b]4、测试mysql是否安装上[/b]

D:\>cd D:\Program Files\mysql-5.1.39-win32\bin

D:\Program Files\mysql-5.1.39-win32\bin>mysqlshow
+--------------------+
| Databases |
+--------------------+
| information_schema |
| test |
+--------------------+

[b]5、关闭服务[/b]
D:\Program Files\mysql-5.1.39-win32\bin>mysqladmin -u root shutdown
(直接将命令行窗口关掉也会关闭服务,至于会有什么负面影响,我不知道)

如果此时再执行命令 mysqlshow,则会报错了

D:\Program Files\mysql-5.1.39-win32\bin>mysqlshow
mysqlshow: Can't connect to MySQL server on 'localhost' (10061)

[b]6、创建 option file 来配置你的 mysql路径和数据路径[/b]

在 C:\WINDOWS 下,创建文件 my.ini
文件内容为:

[b][mysqld]
# set basedir to your installation path
basedir=D:/Program Files/mysql-5.1.39-win32
# set datadir to the location of your data directory
datadir=D:/Program Files/mysql-5.1.39-win32/data[/b]

注意:路径用/分隔,如果用\,则要写两个,即\\

[b]7、从命令行连接到mysql[/b]
[b]
D:\Program Files\mysql-5.1.39-win32\bin>mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.39-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>[/b]

mysql会提示你输入密码
Enter password:
什么也别输入,直接回车即可。(至于说在哪里设置用户名及密码,俺还不知道......慢慢学了)

当然,如果mysql运行在你本机上,直接
D:\Program Files\mysql-5.1.39-win32\bin>mysql -u root -p
就行,不需要指定服务器地址。

[b]8、退出连接[/b]
[b]mysql> quit;
Bye[/b]
[b]
9、查看目前已有的数据库[/b]
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.02 sec)


[b]10、创建数据库[/b]

[b]mysql> create database deqiallen_wp1;
Query OK, 1 row affected (0.02 sec)[/b]


参考:[url]http://dev.mysql.com/doc/refman/5.0/en/windows-create-option-file.html[/url]
[url=http://dev.mysql.com/doc/refman/5.1/en/tutorial.html]mysql 5.1参考手册[/url]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值